name: Docker build and push on: push: branches: [ master ] workflow_dispatch: jobs: build: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v2 - name: Login to ghcr registry uses: docker/login-action@v1 with: registry: ghcr.io username: ${{ secrets.GH_USERNAME }} password: ${{ secrets.GH_ACCESS_TOKEN }} - name: Prepare version info run: | echo "LATEST_COMMIT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV - name: Build and push Docker images uses: docker/build-push-action@v2.2.2 with: context: . file: ./Dockerfile tags: | ghcr.io/studentiunimi/overleaf-registration:${{ env.LATEST_COMMIT_SHA }} ghcr.io/studentiunimi/overleaf-registration:latest push: true