Repository navigation
133 lines (120 loc) · 5.11 KB
/
Copy pathrelease.yml
File metadata and controls
133 lines (120 loc) · 5.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Publish marketplace pack
on:
push:
tags:
- "v*"
permissions:
contents: read
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Check out tagged source
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
# Signature verification needs the annotated tag object, not only the
# commit that a shallow tag checkout resolves to.
fetch-depth: 0
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.12"
- name: Install pinned official signature verifier
run: |
verifier_dir="$RUNNER_TEMP/terraphim-tsm-verifier"
mkdir -p "$verifier_dir"
curl --fail --location --silent --show-error --retry 2 \
https://downloads.terraphim-skills.md/tsm/v0.1.16/tsm-0.1.16-x86_64-unknown-linux-gnu.tar.gz \
--output "$verifier_dir/tsm.tar.gz"
printf '%s %s\n' \
0a785a17e70bf724ff3a387dfa5d011d2e23e09913e4a774553cfad64a8c1765 \
"$verifier_dir/tsm.tar.gz" | sha256sum --check --strict
tar -xzf "$verifier_dir/tsm.tar.gz" -C "$verifier_dir" tsm
- name: Verify every original signed skill
run: |
python3 scripts/verify_kilo_distribution.py \
--inputs integrations/kilo/release-inputs.json \
--source-root skills --tsm "$RUNNER_TEMP/terraphim-tsm-verifier/tsm"
- name: Validate tagged pack
env:
TERRAPHIM_TSM_VERIFIER: ${{ runner.temp }}/terraphim-tsm-verifier/tsm
run: |
expected_tag="v$(python3 scripts/generate_distribution.py --print-version)"
test "$GITHUB_REF_NAME" = "$expected_tag"
# actions/checkout can leave the event tag name pointing at the
# peeled commit. Fetch the remote annotated tag into a private ref so
# signature verification always targets the tag object itself.
release_ref="refs/release-tags/$GITHUB_REF_NAME"
git fetch --no-tags --force origin \
"refs/tags/$GITHUB_REF_NAME:$release_ref"
test "$(git rev-list -n 1 "$release_ref")" = "$GITHUB_SHA"
git config gpg.format ssh
git config gpg.ssh.allowedSignersFile \
"$GITHUB_WORKSPACE/.github/trusted-release-signers"
git verify-tag "$release_ref"
python3 scripts/generate_distribution.py --check
python3 -m unittest discover -s tests -p 'test_*.py'
- name: Rebuild and compare AutoClaw archives
run: |
output="$(mktemp -d)"
python3 scripts/generate_distribution.py --autoclaw-dist "$output"
diff -u dist/autoclaw/SHA256SUMS "$output/SHA256SUMS"
for archive in dist/autoclaw/*.zip; do
name="$(basename "$archive")"
cmp "$archive" "$output/$name"
done
publish:
needs: validate
concurrency:
group: skills-publish-${{ github.ref }}
cancel-in-progress: false
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out validated tagged source
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false
- name: Re-verify immutable release tag
run: |
release_ref="refs/release-tags/$GITHUB_REF_NAME"
git fetch --no-tags --force origin \
"refs/tags/$GITHUB_REF_NAME:$release_ref"
test "$(git rev-list -n 1 "$release_ref")" = "$GITHUB_SHA"
git config gpg.format ssh
git config gpg.ssh.allowedSignersFile \
"$GITHUB_WORKSPACE/.github/trusted-release-signers"
git verify-tag "$release_ref"
- name: Publish immutable release assets
env:
GH_TOKEN: ${{ github.token }}
run: |
if gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --json tagName; then
# A retry never uploads or replaces existing assets. The next step
# verifies the complete immutable release against this tagged source.
echo "Release already exists; verifying its published assets."
else
gh release create "$GITHUB_REF_NAME" \
dist/autoclaw/*.zip \
dist/autoclaw/SHA256SUMS \
assets/v-model-overview.svg \
assets/v-model-overview.png \
--repo "$GITHUB_REPOSITORY" \
--title "Terraphim Skills Introduction $GITHUB_REF_NAME" \
--generate-notes \
--verify-tag
fi
- name: Read back every public release asset
run: |
python3 scripts/verify_published_release.py \
--tag "$GITHUB_REF_NAME" \
--receipt "$RUNNER_TEMP/published-release.json"
- name: Retain actual public readback
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: published-release-readback
path: ${{ runner.temp }}/published-release.json
if-no-files-found: error