publish #1270
This file contains hidden or 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: publish | |
| on: | |
| workflow_run: | |
| workflows: ["build"] | |
| types: | |
| - completed | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| steps: | |
| - name: Dump GitHub context | |
| run: echo "$GITHUB_CONTEXT" | |
| env: | |
| GITHUB_CONTEXT: ${{ toJSON(github) }} | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event.workflow_run.head_sha }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USER }} | |
| password: ${{ secrets.DOCKER_PASS }} | |
| - name: build and push docker image (pull_request) | |
| if: ${{ github.event.workflow_run.event == 'pull_request' }} | |
| uses: docker/build-push-action@v6 | |
| with: | |
| push: true | |
| context: . | |
| build-args: COMMITHASH=${{ github.event.workflow_run.head_sha }} | |
| platforms: linux/amd64 | |
| tags: getfider/fider:PR_${{ github.event.workflow_run.pull_requests[0].number }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: build and push docker image (push branch) | |
| if: ${{ github.event.workflow_run.event == 'push' }} | |
| uses: docker/build-push-action@v6 | |
| with: | |
| push: true | |
| context: . | |
| build-args: COMMITHASH=${{ github.event.workflow_run.head_sha }} | |
| platforms: linux/amd64,linux/arm64/v8 | |
| tags: | | |
| getfider/fider:SHA_${{ github.event.workflow_run.head_sha }} | |
| getfider/fider:${{ github.event.workflow_run.head_branch == 'main' && 'main' || 'stable' }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: build and push docker image (push tag) | |
| if: ${{ github.event.workflow_run.event == 'release' }} | |
| uses: docker/build-push-action@v6 | |
| with: | |
| push: true | |
| context: . | |
| build-args: | | |
| COMMITHASH=${{ github.event.workflow_run.head_sha }} | |
| VERSION=${{ github.event.workflow_run.display_title }} | |
| platforms: linux/amd64,linux/arm64/v8 | |
| tags: getfider/fider:${{ github.event.workflow_run.display_title }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |