Bump version 1.4.2 #2
Workflow file for this run
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
| # https://gist.github.com/rexzhang/47a5b0e7baa8101bbfdef50c990e5337 | |
| name: Publish Docker Image to Docker Hub and GHCR | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| jobs: | |
| docker: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| # This is used to complete the identity challenge | |
| # with sigstore/fulcio when running outside of PRs. | |
| id-token: write | |
| steps: | |
| - name: Prepare | |
| id: prep | |
| run: | | |
| DOCKER_IMAGE=${{ vars.DOCKERHUB_REPOSITORY }} | |
| GHCR_IMAGE=ghcr.io/${{ github.repository }} | |
| VERSION=edge | |
| if [[ $GITHUB_REF == refs/tags/* ]]; then | |
| VERSION=${GITHUB_REF#refs/tags/v} | |
| fi | |
| if [ "${{ github.event_name }}" = "schedule" ]; then | |
| VERSION=nightly | |
| fi | |
| TAGS="${DOCKER_IMAGE}:${VERSION},${GHCR_IMAGE}:${VERSION}" | |
| if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}(\.[0-9]{1,3})?$ ]]; then | |
| TAGS="$TAGS,${DOCKER_IMAGE}:latest,${GHCR_IMAGE}:latest" | |
| fi | |
| echo "tags=${TAGS}" >> $GITHUB_OUTPUT | |
| - name: Checkout repository | |
| # https://github.com/actions/checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| # https://github.com/docker/setup-qemu-action | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| platforms: all | |
| - name: Set up Docker Buildx | |
| # https://github.com/docker/setup-buildx-action | |
| id: buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to DockerHub | |
| # https://github.com/docker/login-action | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Log in to GHCR | |
| # https://github.com/docker/login-action | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push | |
| # https://github.com/docker/build-push-action | |
| id: docker_build | |
| uses: docker/build-push-action@v6 | |
| with: | |
| builder: ${{ steps.buildx.outputs.name }} | |
| context: . | |
| file: ./Dockerfile | |
| platforms: linux/amd64,linux/arm64 | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ steps.prep.outputs.tags }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Image digest | |
| run: echo ${{ steps.docker_build.outputs.digest }} |