feat(releaseupdate): signed OCI distribution sources for releases and the catalogue (#1715)
This commit is contained in:
37 files changed
+1349
-656
No files matched your search
@@ -373,45 +373,45 @@ jobs:
|
||||
# rather than fail the release on its absence.
|
||||
[ -f README.md ] && cp README.md "$name/"
|
||||
zip -r "$name.zip" "$name"
|
||||
sha256sum "$name.zip" > SHA256SUMS
|
||||
echo "name=$name" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Upload distribution zip
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ steps.zip.outputs.name }}
|
||||
path: |
|
||||
${{ steps.zip.outputs.name }}.zip
|
||||
SHA256SUMS
|
||||
path: ${{ steps.zip.outputs.name }}.zip
|
||||
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 a
|
||||
# login, and expires after 90 days. Until this step existed the
|
||||
# zip was produced and then stranded.
|
||||
#
|
||||
# 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 Gitea release with the distribution zip
|
||||
# Installs and updates take a release from the signed artifact in the
|
||||
# registry, so this is what publishes it: the statement signed with
|
||||
# RELEASE_SIGNING_KEY and the zip, tagged v<version>, next, and stable
|
||||
# unless it is a prerelease.
|
||||
- name: Log in to the Gitea registry
|
||||
run: echo "${{ secrets.DEPLOY_TOKEN }}" | docker login git.catlow.cloud -u "${{ github.actor }}" --password-stdin
|
||||
|
||||
- name: Publish the signed release
|
||||
env:
|
||||
ARCHIE_RELEASE_SEED: ${{ secrets.RELEASE_SIGNING_KEY }}
|
||||
run: |
|
||||
set -e
|
||||
version="${{ steps.version.outputs.version }}"
|
||||
prerelease=false
|
||||
case "$version" in *-*) prerelease=true ;; esac
|
||||
./dist/archied release publish -source git.catlow.cloud/sam/archie \
|
||||
-version "$version" -prerelease="$prerelease" \
|
||||
-zip "${{ steps.zip.outputs.name }}.zip" \
|
||||
-agent-image "git.catlow.cloud/sam/archie-agent@${{ needs.agent-image.outputs.agent_digest }}" \
|
||||
-changelog "https://git.catlow.cloud/sam/archie/releases/tag/v$version"
|
||||
|
||||
# The release page carries this version's changelog section, the
|
||||
# release's own reviewed prose; the signed statement links to it.
|
||||
- name: Publish the Gitea release notes
|
||||
env:
|
||||
# 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 }}"
|
||||
if ! git ls-remote --exit-code --tags origin "refs/tags/$tag" >/dev/null; then
|
||||
tag="archied/v${{ steps.version.outputs.version }}"
|
||||
fi
|
||||
version="${{ steps.version.outputs.version }}"
|
||||
# The release body is this version's changelog section, not the whole
|
||||
# file: from its "## [x.y.z]" heading to the next "## [" heading.
|
||||
# Extracting rather than inlining keeps the changelog the single
|
||||
# source of truth, and the tag/changelog gate above has already
|
||||
# proven that section exists.
|
||||
notes="$(mktemp)"
|
||||
awk -v hdr="## [$version]" '
|
||||
index($0, hdr) == 1 { printing = 1 }
|
||||
@@ -425,19 +425,10 @@ jobs:
|
||||
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.
|
||||
# Idempotent: a re-run replaces the release on the tag.
|
||||
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")" \
|
||||
curl -sf -X POST -H "$auth" -H "Content-Type: application/json" \
|
||||
-d "$(jq -n --arg tag "$tag" --arg name "Archie 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"
|
||||
"$api/repos/$repo/releases" >/dev/null
|
||||
echo "published release notes for $tag"
|
||||
Reference in new issue
Block a user