feat: fix CI bug of not triggering Docker push (#2) #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: [ push, pull_request ] | |
jobs: | |
release-and-push: | |
name: Release And Push | |
runs-on: ubuntu-latest | |
if: github.repository == 'casvisor/guacd' && github.event_name == 'push' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Get version | |
id: get-version | |
run: echo "::set-output name=version::$(cat VERSION)" | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v3 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
if: github.repository == 'casvisor/guacd' && github.event_name == 'push' | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Push to Docker Hub | |
uses: docker/build-push-action@v3 | |
if: github.repository == 'casvisor/guacd' && github.event_name == 'push' | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: casbin/guacd:${{ steps.get-version.outputs.version }},casbin/guacd:latest |