Skip to content

Merge pull request #522 from scidsg/admin-vis #36

Merge pull request #522 from scidsg/admin-vis

Merge pull request #522 from scidsg/admin-vis #36

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: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository }}/hushline:${{ github.ref_name }}
ghcr.io/${{ github.repository }}/hushline:release
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
deploy:
runs-on: ubuntu-latest
needs: build-and-push
steps:
- name: Install doctl and authenticate
run: |
sudo snap install doctl jq
doctl auth init -t $DIGITALOCEAN_TOKEN
env:
DIGITALOCEAN_TOKEN: ${{ secrets.DIGITALOCEAN_TOKEN }}
- name: Trigger deployment on DigitalOcean App Platform
run: |
app_id=$(doctl apps list --output json| jq '.[] | select(.spec.name == "hushline-prod") | .id' -r)
doctl apps create-deployment $app_id --force-rebuild --wait
env:
DIGITALOCEAN_APP_ID: ${{ secrets.DIGITALOCEAN_APP_ID }}