v-2024-11-14.0 #76
Workflow file for this run
This file contains 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: Build and publish image to Docker Hub | |
on: | |
release: | |
types: [published] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# Github stores the current tag in an enviroment variable (GITHUB_REF) in the format /refs/tags/TAG_NAME. | |
# Using shell parameter expansion, we extract the TAG_NAME. Also, it seems we cannot use shell tricks | |
# directly in the with block, so doing it in a separate step and then fetching its output when needed. | |
- name: Get the tag name | |
id: get_tag | |
run: echo ::set-output name=TAG::${GITHUB_REF/refs\/tags\//} | |
- name: Docker Setup Buildx | |
uses: docker/setup-buildx-action@v1.3.0 | |
- name: Docker Login | |
uses: docker/login-action@v1.9.0 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
- name: Build and push Docker images | |
uses: docker/build-push-action@v2.4.0 | |
with: | |
build-args: GIT_COMMIT_SHA=${{ steps.get_tag.outputs.TAG }} | |
cache-from: metabrainz/metabrainz:cache | |
cache-to: metabrainz/metabrainz:cache | |
push: true | |
tags: metabrainz/metabrainz:${{ steps.get_tag.outputs.TAG }} |