Merge pull request #742 from scidsg/glenn-sorrentino-patch-2 #6
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 release container image | |
on: | |
push: | |
tags: | |
- "v*" | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Make sure the version string matches the tag | |
run: | | |
HUSHLINE_VERSION=$(cat hushline/version.py | cut -d'"' -f2) | |
TAG_VERSION=${GITHUB_REF#refs/tags/} | |
TAG_VERSION=${TAG_VERSION#v} # strip the leading 'v' from the tag | |
if [ "$HUSHLINE_VERSION" != "$TAG_VERSION" ]; then | |
echo "::error file=hushline/version.py,title=Version check failed::Version string in hushline/version.py $HUSHLINE_VERSION does not match the tag $TAG_VERSION" | |
exit 1 | |
fi | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Log in to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile.prod | |
push: true | |
tags: | | |
ghcr.io/${{ github.repository }}/hushline:${{ github.ref_name }} | |
ghcr.io/${{ github.repository }}/hushline:release | |
scidsg/hushline:${{ github.ref_name }} | |
scidsg/hushline:release | |
platforms: linux/amd64,linux/arm64 | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |