Manual Release Docker Image #13
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: Manual Release Docker Image | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'The version to release (e.g., 1.2.3)' | |
| required: true | |
| type: string | |
| tag_as_latest: | |
| description: "Tag this release as 'latest' as well?" | |
| required: true | |
| type: boolean | |
| default: false | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| env: | |
| DOCKER_IMAGE_NAME: ${{ vars.DOCKER_IMAGE_NAME }} | |
| steps: | |
| - name: Check out 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: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Prepare Docker tags based on input | |
| id: prep_tags | |
| run: | | |
| # Always include the version-specific tag from the input | |
| TAGS="${DOCKER_IMAGE_NAME}:${{ github.event.inputs.version }}" | |
| # Conditionally add the 'latest' tag if the user selected 'true' | |
| if [[ "${{ github.event.inputs.tag_as_latest }}" == 'true' ]]; then | |
| echo "✅ User chose to tag as 'latest'." | |
| TAGS="${TAGS} | |
| ${DOCKER_IMAGE_NAME}:latest" | |
| else | |
| echo "☑️ User chose not to tag as 'latest'." | |
| fi | |
| echo "tags<<EOF" >> $GITHUB_OUTPUT | |
| echo "${TAGS}" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Build & push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ steps.prep_tags.outputs.tags }} |