2FAuth/.github/workflows/ci-docker-publish-dev.yml
2023-03-24 11:28:24 +01:00

90 lines
2.3 KiB
YAML

name: ci-docker-publish-dev
on:
push:
branches:
- dev
paths:
- .github/workflows/ci-docker-publish-dev.yml
- app/**
- bootstrap/**
- config/**
- database/**
- docker/**
- public/**
- resources/**
- routes/**
- storage/**
- tests/**
- .dockerignore
- .env.travis
- artisan
- composer.json
- composer.lock
- Dockerfile
- phpunit.xml
- server.php
pull_request:
branches:
- dev
paths:
- .github/workflows/ci-docker-publish-dev.yml
- app/**
- bootstrap/**
- config/**
- database/**
- docker/**
- public/**
- resources/**
- routes/**
- storage/**
- tests/**
- .dockerignore
- .env.travis
- artisan
- composer.json
- composer.lock
- Dockerfile
- phpunit.xml
- server.php
jobs:
publish:
if: |
(github.event_name == 'push' && github.repository == 'Bubka/2FAuth') ||
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'Bubka/2FAuth' && github.actor != 'dependabot[bot]')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
username: 2fauth
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Set variables
id: set_vars
env:
EVENT_NAME: ${{ github.event_name }}
run: |
echo "commit=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "created=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_OUTPUT
echo "platforms=linux/amd64,linux/386" >> $GITHUB_OUTPUT
- name: Build and push to docker Hub
uses: docker/build-push-action@v4
with:
platforms: ${{ steps.set_vars.outputs.platforms }}
build-args: |
CREATED=${{ steps.set_vars.outputs.created }}
COMMIT=${{ steps.set_vars.outputs.commit }}
VERSION=dev
tags: |
2fauth/2fauth:dev
push: true