multiarch build #15
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
| name: Publish | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| - test-build-docker | |
| tags: | |
| - "*" | |
| workflow_dispatch: | |
| inputs: | |
| docker_tag: | |
| description: "Tag suffix; will be used as seedplatform/bsyncr-server:{docker_tag}" | |
| required: true | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| with: | |
| install: true | |
| - name: Cache Docker layers | |
| uses: actions/cache@v3 | |
| with: | |
| path: /tmp/.buildx-cache | |
| key: ${{ runner.os }}-buildx-${{ github.sha }} | |
| restore-keys: | | |
| ${{ runner.os }}-buildx- | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Parse tag | |
| id: parse_tag | |
| run: | | |
| DOCKER_IMAGE=seedplatform/bsyncr-server | |
| if [[ ${GITHUB_EVENT_NAME} == "push" ]]; then | |
| case "${GITHUB_REF}" in | |
| "refs/heads/test-build-docker") | |
| BSYNCR_TAG=${DOCKER_IMAGE}:test-build-docker | |
| ;; | |
| "refs/heads/develop") | |
| BSYNCR_TAG=${DOCKER_IMAGE}:develop | |
| ;; | |
| refs/tags/v*) | |
| BSYNCR_TAG=${DOCKER_IMAGE}:${GITHUB_REF#refs/tags/v},${DOCKER_IMAGE}:latest | |
| ;; | |
| *) | |
| echo "Unhandled GITHUB_REF (this shouldn't happen), exiting" | |
| exit 1 | |
| ;; | |
| esac | |
| elif [[ ${GITHUB_EVENT_NAME} == "workflow_dispatch" ]]; then | |
| BSYNCR_TAG=${DOCKER_IMAGE}:${{ github.event.inputs.docker_tag }} | |
| else | |
| echo "Unhandled event type (this shouldn't happen), exiting" | |
| exit 1 | |
| fi | |
| echo "bsyncr_server_tags=${BSYNCR_TAG}" >> $GITHUB_OUTPUT | |
| echo "BSYNCR_TAG=${BSYNCR_TAG}" | |
| - name: Build and push multi-arch image | |
| id: docker_build | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| push: true | |
| platforms: linux/amd64,linux/arm64 | |
| tags: ${{ steps.parse_tag.outputs.bsyncr_server_tags }} |