diff options
-rw-r--r-- | .github/workflows/forms-backend.yml | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/.github/workflows/forms-backend.yml b/.github/workflows/forms-backend.yml index 5d9e2eb..0d222b6 100644 --- a/.github/workflows/forms-backend.yml +++ b/.github/workflows/forms-backend.yml @@ -60,3 +60,41 @@ jobs: # This implemention allows showing linting errors in PRs under Files tab. - name: Run flake8 run: "flake8 --format='::error file=%(path)s,line=%(row)d,col=%(col)d::[flake8] %(code)s: %(text)s''" + + build: + name: Build & Push + runs-on: ubuntu-latest + + needs: [lint] + if: github.ref == 'refs/heads/main' + + steps: + - name: Create SHA Container Tag + id: sha_tag + run: | + tag=$(cut -c 1-7 <<< $GITHUB_SHA) + echo "::set-output name=tag::$tag" + + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Setup Docker BuildX + uses: docker/setup-buildx-action@v1 + + - name: Login to Github Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ secrets.GHCR_USER }} + password: ${{ secrets.GHCR_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + push: true + cache-from: type=registry,ref=ghcr.io/python-discord/forms-backend:latest + tags: | + ghcr.io/python-discord/forms-backend:latest + ghcr.io/python-discord/forms-backend:${{ steps.sha_tag.outputs.tag }} |