The deploy workflow now targets git.catlow.cloud: images push to the Gitea registry and the distribution zip publishes as a release on sam/archie through the Gitea API, both authenticated with one DEPLOY_TOKEN PAT (write:packages + write:repository scopes). Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
1 file changed
+44
-40
@@ -1,6 +1,7 @@
|
||||
# Builds and pushes the archied and archie-agent images to GHCR on every
|
||||
# merge to main. Mirrors .gitea/workflows/deploy.yml, which remains the
|
||||
# production build path against git.catlow.cloud until that's cut over.
|
||||
# Builds and pushes the archied and archie-agent images to the Gitea
|
||||
# registry on every merge to main, and publishes the distribution zip as a
|
||||
# release on this repository. Gitea Actions reads this .github/workflows/
|
||||
# directory.
|
||||
name: deploy
|
||||
|
||||
on:
|
||||
@@ -193,8 +194,8 @@ jobs:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to GHCR
|
||||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
|
||||
- name: Log in to the Gitea registry
|
||||
run: echo "${{ secrets.DEPLOY_TOKEN }}" | docker login git.catlow.cloud -u "${{ github.actor }}" --password-stdin
|
||||
|
||||
- name: Resolve component versions
|
||||
id: versions
|
||||
@@ -240,10 +241,10 @@ jobs:
|
||||
{
|
||||
echo "archied_tags<<EOF"
|
||||
if [ -n "$RELEASE_TAG" ]; then
|
||||
echo "ghcr.io/samcharles93/archied:latest"
|
||||
echo "git.catlow.cloud/sam/archied:latest"
|
||||
fi
|
||||
echo "ghcr.io/samcharles93/archied:edge"
|
||||
echo "ghcr.io/samcharles93/archied:sha-${{ steps.commit.outputs.sha }}"
|
||||
echo "git.catlow.cloud/sam/archied:edge"
|
||||
echo "git.catlow.cloud/sam/archied:sha-${{ steps.commit.outputs.sha }}"
|
||||
echo "EOF"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
|
||||
@@ -283,8 +284,8 @@ jobs:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to GHCR
|
||||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
|
||||
- name: Log in to the Gitea registry
|
||||
run: echo "${{ secrets.DEPLOY_TOKEN }}" | docker login git.catlow.cloud -u "${{ github.actor }}" --password-stdin
|
||||
|
||||
- name: Resolve runtime version
|
||||
id: versions
|
||||
@@ -306,8 +307,8 @@ jobs:
|
||||
file: Dockerfile
|
||||
push: true
|
||||
tags: |
|
||||
ghcr.io/samcharles93/archie-agent:latest
|
||||
ghcr.io/samcharles93/archie-agent:sha-${{ steps.commit.outputs.sha }}
|
||||
git.catlow.cloud/sam/archie-agent:latest
|
||||
git.catlow.cloud/sam/archie-agent:sha-${{ steps.commit.outputs.sha }}
|
||||
build-args: |
|
||||
RUNTIME_VERSION=${{ steps.versions.outputs.runtime }}
|
||||
cache-from: type=gha,scope=archie-agent
|
||||
@@ -331,10 +332,6 @@ jobs:
|
||||
# archied tag at HEAD.
|
||||
if: needs.gate.outputs.archied_version != ''
|
||||
runs-on: self-hosted
|
||||
# Least privilege: the workflow default is contents:read, and only this
|
||||
# job needs to write, to create the Release and attach the zip to it.
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
@@ -387,7 +384,7 @@ jobs:
|
||||
cp deployments/INSTRUCTIONS.md CHANGELOG.md "$name/"
|
||||
digest='${{ needs.agent-image.outputs.agent_digest }}'
|
||||
test -n "$digest"
|
||||
jq --arg image "ghcr.io/samcharles93/archie-agent@$digest" '. + {agent_image: $image}' release.json > "$name/release.json"
|
||||
jq --arg image "git.catlow.cloud/sam/archie-agent@$digest" '. + {agent_image: $image}' release.json > "$name/release.json"
|
||||
# README.md doesn't exist yet in this repo; include it once it does
|
||||
# rather than fail the release on its absence.
|
||||
[ -f README.md ] && cp README.md "$name/"
|
||||
@@ -404,21 +401,21 @@ jobs:
|
||||
SHA256SUMS
|
||||
retention-days: 90
|
||||
|
||||
# A Release is what an operator can actually download from; the
|
||||
# artifact above is reachable only from the run's page, behind an
|
||||
# Actions login, and expires after 90 days. Until this step existed the
|
||||
# zip was produced and then stranded -- the only Release on this repo
|
||||
# (archied/v1.22.0) was created by hand and carries no asset at all.
|
||||
# A release is what an operator can actually download from; the
|
||||
# artifact above is reachable only from the run's page, behind a
|
||||
# login, and expires after 90 days. Until this step existed the
|
||||
# zip was produced and then stranded.
|
||||
#
|
||||
# Attached to the release's v* tag, or the archied tag for a release
|
||||
# cut before the single release stream.
|
||||
# --generate-notes is deliberately not used: the changelog section is
|
||||
# the release's own reviewed prose, and the tag/changelog gate above
|
||||
# The release lives on this repository, attached to the release's v*
|
||||
# tag, or the archied tag for a release cut before the single release
|
||||
# stream. The body is the changelog section -- the release's own
|
||||
# reviewed prose -- not generated notes: the tag/changelog gate above
|
||||
# already guarantees it describes this version.
|
||||
- name: Publish GitHub Release with the distribution zip
|
||||
- name: Publish Gitea release with the distribution zip
|
||||
env:
|
||||
# GITHUB_TOKEN cannot write to another repository.
|
||||
GH_TOKEN: ${{ secrets.RELEASES_TOKEN }}
|
||||
# One PAT covers this step and the image jobs' registry login. It
|
||||
# needs write:packages and write:repository scopes.
|
||||
DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
|
||||
run: |
|
||||
set -e
|
||||
tag="v${{ steps.version.outputs.version }}"
|
||||
@@ -441,15 +438,22 @@ jobs:
|
||||
echo "no [$version] section extracted from CHANGELOG.md" >&2
|
||||
exit 1
|
||||
fi
|
||||
# Idempotent: --clobber replaces the asset and leaves the notes
|
||||
# alone, so a re-run of this job (a retried or superseded deploy)
|
||||
# cannot fail on an existing Release or duplicate the zip.
|
||||
if gh release view "$tag" -R samcharles93/archie-releases >/dev/null 2>&1; then
|
||||
gh release upload "$tag" -R samcharles93/archie-releases "${{ steps.zip.outputs.name }}.zip" SHA256SUMS install.sh --clobber
|
||||
else
|
||||
gh release create "$tag" -R samcharles93/archie-releases \
|
||||
--title "archied v$version" \
|
||||
--notes-file "$notes" \
|
||||
"${{ steps.zip.outputs.name }}.zip" SHA256SUMS install.sh
|
||||
fi
|
||||
api="https://git.catlow.cloud/api/v1"
|
||||
repo="sam/archie"
|
||||
auth="Authorization: token $DEPLOY_TOKEN"
|
||||
# Idempotent: drop any release already on the tag and recreate it,
|
||||
# so a re-run of this job (a retried or superseded deploy) cannot
|
||||
# fail on an existing release or duplicate the zip. Deleting a
|
||||
# release leaves the tag itself alone.
|
||||
curl -sf -X DELETE -H "$auth" "$api/repos/$repo/releases/tags/$tag" >/dev/null || true
|
||||
id="$(curl -sf -X POST -H "$auth" -H "Content-Type: application/json" \
|
||||
-d "$(jq -n --arg tag "$tag" --arg name "archied v$version" --arg body "$(cat "$notes")" \
|
||||
'{tag_name: $tag, name: $name, body: $body, draft: false, prerelease: false}')" \
|
||||
"$api/repos/$repo/releases" | jq -r '.id')"
|
||||
test -n "$id"
|
||||
for asset in "${{ steps.zip.outputs.name }}.zip" SHA256SUMS install.sh; do
|
||||
curl -sf -X POST -H "$auth" -H "Content-Type: application/octet-stream" \
|
||||
--data-binary "@$asset" \
|
||||
"$api/repos/$repo/releases/$id/assets?name=$(basename "$asset")" >/dev/null
|
||||
done
|
||||
echo "published $tag with ${{ steps.zip.outputs.name }}.zip"
|
||||
Reference in new issue
Block a user