Release Docker image #33
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: Release Docker image | |
| on: | |
| push: | |
| tags: | |
| - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | |
| workflow_dispatch: | |
| inputs: | |
| koel_version: | |
| description: 'Koel release tag to build against (e.g. v9.4.0). Required when triggered manually.' | |
| required: true | |
| type: string | |
| permissions: read-all | |
| jobs: | |
| test: | |
| name: Run tests | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Run tests | |
| uses: ./.github/actions/test | |
| deploy: | |
| name: Deploy to Docker Hub | |
| runs-on: ubuntu-24.04 | |
| needs: [test] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v4 | |
| id: qemu | |
| with: | |
| platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
| - name: Set up Docker Build | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v4 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
| - name: Resolve version | |
| id: version | |
| # env-var indirection to prevent template injection from the dispatch input | |
| env: | |
| KOEL_VERSION: ${{ inputs.koel_version }} | |
| run: | | |
| REF="${KOEL_VERSION:-$GITHUB_REF_NAME}" | |
| echo "VERSION=${REF#v}" >> "$GITHUB_OUTPUT" | |
| echo "TAG=${REF}" >> "$GITHUB_OUTPUT" | |
| - name: Build and push the production image | |
| uses: docker/build-push-action@v7 | |
| with: | |
| push: true | |
| tags: phanan/koel:latest,phanan/koel:${{ steps.version.outputs.VERSION }} | |
| platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
| build-args: | | |
| KOEL_VERSION_REF=${{ steps.version.outputs.TAG }} |