After the release is published, a deploy job checks out the deployment definition from tern-server at the same tag, confirms the server image for that version exists, and runs it through ygg/actions/deploy. It runs here because tags go out server-first and the single runner works through them in order, so both artifacts exist by now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fee4a2eb13
commit
e6ce5e26c7
1 file changed
+51
@@ -44,3 +44,54 @@ jobs:
|
||||
files: |-
|
||||
tern-web-*.tgz
|
||||
tern-web-*.tgz.sha256
|
||||
|
||||
# Deploys the release to tern.mtps.pl (kara, deploy/compose). It lives
|
||||
# here rather than in tern-server because tags are pushed server-first and
|
||||
# the single runner works through them in order, so by the time this runs
|
||||
# both the server image and this webapp release exist. A deploy job in
|
||||
# tern-server would have to wait for this repo's release while holding
|
||||
# the only runner.
|
||||
deploy:
|
||||
needs: release
|
||||
runs-on: rocky-10
|
||||
steps:
|
||||
# The deployment definition is versioned with the server it deploys.
|
||||
- name: Check out deployment definition
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: mtps/tern-server
|
||||
ref: ${{ gitea.ref_name }}
|
||||
|
||||
- name: Check the server image exists
|
||||
env:
|
||||
IMAGE: git.app.ygg/mtps/tern-server
|
||||
TAG: ${{ gitea.ref_name }}
|
||||
run: |
|
||||
# Fails fast with a clear message if the server release didn't
|
||||
# publish this version (failed, or still running on another
|
||||
# runner), instead of a deploy that can't pull its image.
|
||||
VERSION="${TAG#v}"
|
||||
for i in $(seq 1 20); do
|
||||
docker manifest inspect "$IMAGE:$VERSION" >/dev/null 2>&1 && exit 0
|
||||
echo "waiting for $IMAGE:$VERSION ($i/20)"
|
||||
sleep 30
|
||||
done
|
||||
echo "::error::$IMAGE:$VERSION not found in the registry — did the tern-server release succeed?"
|
||||
exit 1
|
||||
|
||||
- name: Derive version
|
||||
id: version
|
||||
env:
|
||||
TAG: ${{ gitea.ref_name }}
|
||||
run: echo "version=${TAG#v}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Deploy
|
||||
uses: https://git.app.ygg/ygg/actions/deploy@v2
|
||||
with:
|
||||
type: compose
|
||||
dist-path: deploy/tern.yml
|
||||
extra-vars: |
|
||||
version=${{ steps.version.outputs.version }}
|
||||
ssh-key: ${{ secrets.DEPLOY_SSH_KEY }}
|
||||
known-hosts: ${{ secrets.DEPLOY_KNOWN_HOSTS }}
|
||||
|
||||
Reference in new issue
Block a user