buildx #700
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: buildx | |
| on: | |
| workflow_run: | |
| workflows: ["docker_main"] | |
| branches: [main, updates] | |
| types: | |
| - completed | |
| push: | |
| tags: | |
| - '*' | |
| release: | |
| types: | |
| - published | |
| jobs: | |
| on-success: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Wait for tests to succeed | |
| if: ${{ github.event.workflow_run.conclusion != 'success' && startsWith(github.ref, 'refs/tags') != true }} | |
| run: exit 1 | |
| - name: Debug workflow context | |
| run: | | |
| echo "Event name: ${{ github.event_name }}" | |
| echo "Ref: ${{ github.ref }}" | |
| echo "Actor: ${{ github.actor }}" | |
| echo "Branch: ${{ github.event.workflow_run.head_branch }}" | |
| echo "Conclusion: ${{ github.event.workflow_run.conclusion }}" | |
| - name: checkout code | |
| uses: actions/checkout@v4 | |
| - 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_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Login to ghcr.io | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| # Disabled: only build on release events now | |
| # - name: build and push the image | |
| # if: startsWith(github.ref, 'refs/heads/main') && (github.actor == 'benbusby' || github.actor == 'Don-Swanson') | |
| # run: | | |
| # docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | |
| # docker buildx ls | |
| # docker buildx build --push \ | |
| # --tag benbusby/whoogle-search:latest \ | |
| # --platform linux/amd64,linux/arm64 . | |
| # docker buildx build --push \ | |
| # --tag ghcr.io/benbusby/whoogle-search:latest \ | |
| # --platform linux/amd64,linux/arm64 . | |
| - name: build and push updates branch (update-testing tag) | |
| if: github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'updates' && github.event.workflow_run.conclusion == 'success' && (github.event.workflow_run.actor.login == 'benbusby' || github.event.workflow_run.actor.login == 'Don-Swanson') | |
| run: | | |
| docker buildx build --push \ | |
| --tag benbusby/whoogle-search:update-testing \ | |
| --tag ghcr.io/benbusby/whoogle-search:update-testing \ | |
| --platform linux/amd64,linux/arm64 . | |
| - name: build and push release (version + latest) | |
| if: github.event_name == 'release' && github.event.release.prerelease == false && (github.actor == 'benbusby' || github.actor == 'Don-Swanson') | |
| run: | | |
| TAG="${{ github.event.release.tag_name }}" | |
| VERSION="${TAG#v}" | |
| docker buildx build --push \ | |
| --tag benbusby/whoogle-search:${VERSION} \ | |
| --tag benbusby/whoogle-search:latest \ | |
| --tag ghcr.io/benbusby/whoogle-search:${VERSION} \ | |
| --tag ghcr.io/benbusby/whoogle-search:latest \ | |
| --platform linux/amd64,linux/arm64 . | |
| - name: build and push pre-release (version only) | |
| if: github.event_name == 'release' && github.event.release.prerelease == true && (github.actor == 'benbusby' || github.actor == 'Don-Swanson') | |
| run: | | |
| TAG="${{ github.event.release.tag_name }}" | |
| VERSION="${TAG#v}" | |
| docker buildx build --push \ | |
| --tag benbusby/whoogle-search:${VERSION} \ | |
| --tag ghcr.io/benbusby/whoogle-search:${VERSION} \ | |
| --platform linux/amd64,linux/arm64 . | |
| - name: build and push tag | |
| if: startsWith(github.ref, 'refs/tags') | |
| run: | | |
| docker buildx build --push \ | |
| --tag benbusby/whoogle-search:${GITHUB_REF#refs/*/v} \ | |
| --tag ghcr.io/benbusby/whoogle-search:${GITHUB_REF#refs/*/v} \ | |
| --platform linux/amd64,linux/arm64 . |