-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (113 loc) · 4.5 KB
/
Copy pathrelease-on-version-change.yml
File metadata and controls
138 lines (113 loc) · 4.5 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
134
135
136
137
138
name: Release On Version Change
on:
push:
branches:
- main
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Ignore local runner file mode noise
run: git config core.fileMode false
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Detect VERSION changes in this push
id: version_change
env:
BEFORE_SHA: ${{ github.event.before }}
run: |
set -euo pipefail
if [[ "$BEFORE_SHA" == "0000000000000000000000000000000000000000" ]]; then
changed="true"
elif git diff --quiet "$BEFORE_SHA" "$GITHUB_SHA" -- VERSION; then
changed="false"
else
changed="true"
fi
version="$(./scripts/read_version.sh)"
{
echo "changed=$changed"
echo "version=$version"
} >> "$GITHUB_OUTPUT"
- name: Stop when VERSION was not changed
if: steps.version_change.outputs.changed != 'true'
run: |
echo "VERSION did not change in this push; skipping release."
- name: Configure git identity
if: steps.version_change.outputs.changed == 'true' && github.server_url == 'https://github.com'
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Sync manifests and generated files
if: steps.version_change.outputs.changed == 'true'
run: |
set -euo pipefail
./scripts/sync_version.sh
./scripts/sync_claude_plugin_skills.sh
- name: Validate release state
if: steps.version_change.outputs.changed == 'true'
run: |
set -euo pipefail
npx -y skills add . --list
./scripts/tests/version_sync_test.sh
git diff --exit-code -- plugins/tla-workbenches/skills
./scripts/validate_claude_plugin.sh
./scripts/validate_codex_plugin.sh
- name: Commit synced metadata if needed
if: steps.version_change.outputs.changed == 'true' && github.server_url == 'https://github.com'
run: |
set -euo pipefail
if [[ "${AGENT_CI_LOCAL:-}" == "true" ]]; then
echo "Agent CI local run; skipping release metadata commit."
exit 0
fi
version="$(./scripts/read_version.sh)"
if git diff --quiet -- .claude-plugin/marketplace.json plugins/tla-workbenches/.claude-plugin/plugin.json plugins/tla-workbenches/.codex-plugin/plugin.json; then
echo "No manifest sync commit needed."
exit 0
fi
git add .claude-plugin/marketplace.json plugins/tla-workbenches/.claude-plugin/plugin.json plugins/tla-workbenches/.codex-plugin/plugin.json
git commit -m "chore(release): sync metadata for v${version}"
git push origin HEAD:main
- name: Create and push tag
id: release_tag
if: steps.version_change.outputs.changed == 'true' && github.server_url == 'https://github.com'
run: |
set -euo pipefail
if [[ "${AGENT_CI_LOCAL:-}" == "true" ]]; then
echo "Agent CI local run; skipping release tag publish."
echo "created=false" >> "$GITHUB_OUTPUT"
exit 0
fi
tag_name="v$(./scripts/read_version.sh)"
git fetch --tags --force origin
if git ls-remote --tags origin "refs/tags/${tag_name}" | grep -q .; then
echo "Tag already exists on origin: ${tag_name}; skipping release publish."
echo "created=false" >> "$GITHUB_OUTPUT"
exit 0
fi
git tag -a "${tag_name}" -m "Release ${tag_name}"
git push origin "refs/tags/${tag_name}"
echo "created=true" >> "$GITHUB_OUTPUT"
- name: Create GitHub release
if: steps.release_tag.outputs.created == 'true' && github.server_url == 'https://github.com'
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
if [[ "${AGENT_CI_LOCAL:-}" == "true" ]]; then
echo "Agent CI local run; skipping GitHub release publish."
exit 0
fi
TAG_NAME="v$(./scripts/read_version.sh)"
gh release create "${TAG_NAME}" \
--title "${TAG_NAME}" \
--generate-notes