Repository navigation
128 lines (116 loc) · 4.66 KB
/
Copy pathversion-plugins.yml
File metadata and controls
128 lines (116 loc) · 4.66 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
name: version plugins
# Turn merged plugin version bumps into releases. A plugin is versioned by one
# annotated tag `<plugin-directory>-v<package.json version>`; `.github/workflows/release.yml`
# then creates the GitHub release and opens the pull request that republishes
# `index.json` (the Discover plugin index).
#
# A person merges a plugin change that bumps `plugins/<dir>/package.json`; this
# workflow tags every version on main that has no tag yet and dispatches
# `release.yml` for each new tag. The dispatch is required because a tag pushed
# with GITHUB_TOKEN does not start another workflow run.
#
# It is safe to re-run: existing tags are skipped, so a release workflow's own
# index pull request merge is a no-op here.
on:
push:
branches: ["main"]
workflow_dispatch:
# Serialize versioning runs: two merges in a row must not dispatch overlapping
# releases against a moving main (release.yml also serializes itself).
concurrency:
group: plugin-versions
cancel-in-progress: false
permissions:
contents: read
env:
DSH_VERSION: ${{ vars.DSH_VERSION }}
jobs:
version:
name: Tag new plugin versions and dispatch releases
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: write
actions: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# Tags must be visible to decide what is already released.
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24
- name: Install and verify the pinned DSH
run: |
npm install --global "@deepseek-ai/dsh@${DSH_VERSION}"
installed="$(dsh --version)"
if [ "$installed" != "$DSH_VERSION" ]; then
echo "::error::expected DSH ${DSH_VERSION}, got ${installed}"
exit 1
fi
- name: Validate the merged plugins before tagging
run: |
node scripts/validate-github-install.mjs --strict
node scripts/validate-skills.mjs
node scripts/validate-bundles.mjs --dsh-root "$(npm root -g)/@deepseek-ai"
- name: Tag new plugin versions
id: tag
env:
GH_TOKEN: ${{ github.token }}
run: |
git config user.name "sredevopsorgagents"
git config user.email "292528627+sredevopsorgagents@users.noreply.github.com"
tags=""
for manifest in plugins/*/package.json; do
directory="$(basename "$(dirname "$manifest")")"
if [[ ! "$directory" =~ ^[a-z0-9][a-z0-9-]*$ ]]; then
echo "::error::plugin directory must be lowercase kebab-case: plugins/${directory}"
exit 1
fi
is_bundle="$(node -e 'const m = require(process.argv[1]); process.stdout.write(m.dsh?.bundle?.patch === undefined ? "no" : "yes")' "$PWD/$manifest")"
if [ "$is_bundle" != "yes" ]; then
echo "skip plugins/${directory}: not a market bundle"
continue
fi
version="$(node -e 'const m = require(process.argv[1]); process.stdout.write(m.version)' "$PWD/$manifest")"
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+([-+][0-9A-Za-z.-]+)?$ ]]; then
echo "::error::invalid semver for plugins/${directory}: ${version}"
exit 1
fi
tag="${directory}-v${version}"
if git rev-parse -q --verify "refs/tags/${tag}" >/dev/null; then
echo "skip ${tag}: already released"
continue
fi
git tag -a "$tag" -m "Release ${tag}"
git push "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" "refs/tags/${tag}"
echo "created ${tag}"
tags="${tags}${tag}"$'\n'
done
{
echo "tags<<EOF"
printf '%s' "$tags"
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: Dispatch a release for every new tag
if: steps.tag.outputs.tags != ''
env:
GH_TOKEN: ${{ github.token }}
TAGS: ${{ steps.tag.outputs.tags }}
run: |
while IFS= read -r tag; do
[ -n "$tag" ] || continue
echo "dispatching release.yml for ${tag}"
gh workflow run release.yml --ref "$tag" --repo "$GITHUB_REPOSITORY"
done <<< "$TAGS"
- name: Report
env:
TAGS: ${{ steps.tag.outputs.tags }}
run: |
if [ -z "$TAGS" ]; then
echo "no new plugin versions to tag"
else
echo "tagged and dispatched:"
printf '%s' "$TAGS"
fi