Repository navigation
98 lines (93 loc) · 3.97 KB
/
Copy pathplugin-release.yml
File metadata and controls
98 lines (93 loc) · 3.97 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
name: Official plugin catalog
on:
workflow_dispatch:
inputs:
operation:
description: Assemble the catalog or verify the configured signing keys
required: true
default: assemble
type: choice
options: [assemble, verify-keys]
sources:
description: Stable Release tags, source commits and asset SHA-256 digests required for assembly
required: false
type: string
publish:
description: Publish the assembled signed snapshot after verifying all Release assets
required: true
default: false
type: boolean
permissions:
contents: read
concurrency:
group: official-plugin-catalog
cancel-in-progress: false
jobs:
assemble:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115
with:
version: 10.0.0
run_install: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1
with:
node-version: 22.22.1
cache: pnpm
- run: corepack pnpm install --frozen-lockfile
- run: corepack pnpm --filter '@ling-stack/core...' -r run build:ci
- name: Verify configured plugin signing keys
if: inputs.operation == 'verify-keys'
env:
LING_PLUGIN_ARTIFACT_PRIVATE_KEY: ${{ secrets.LING_PLUGIN_ARTIFACT_PRIVATE_KEY }}
LING_PLUGIN_CATALOG_PRIVATE_KEY: ${{ secrets.LING_PLUGIN_CATALOG_PRIVATE_KEY }}
run: node scripts/plugins/verify-official-signing-keys.mjs
- name: Verify released plugin assets and sign the catalog
if: inputs.operation == 'assemble'
env:
GH_TOKEN: ${{ github.token }}
LING_PLUGIN_RELEASE_SOURCES: ${{ inputs.sources }}
LING_PLUGIN_ARTIFACT_PRIVATE_KEY: ${{ secrets.LING_PLUGIN_ARTIFACT_PRIVATE_KEY }}
LING_PLUGIN_CATALOG_PRIVATE_KEY: ${{ secrets.LING_PLUGIN_CATALOG_PRIVATE_KEY }}
run: |
mkdir -p "$RUNNER_TEMP/catalog"
node scripts/plugins/collect-official-releases.mjs "$RUNNER_TEMP/catalog/catalog.json"
node scripts/plugins/sign-catalog.mjs --input "$RUNNER_TEMP/catalog/catalog.json" --output "$RUNNER_TEMP/catalog/catalog.sig" --official
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
if: inputs.operation == 'assemble'
with:
name: official-plugin-catalog
path: ${{ runner.temp }}/catalog/
if-no-files-found: error
publish:
if: inputs.operation == 'assemble' && inputs.publish
needs: assemble
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333
with:
name: official-plugin-catalog
path: ${{ runner.temp }}/catalog
- name: Publish a single catalog snapshot
env:
GH_TOKEN: ${{ github.token }}
run: |
branch=official-plugin-catalog
publish_root="$RUNNER_TEMP/catalog-publisher"
git init -b "$branch" "$publish_root"
git -C "$publish_root" remote add origin "https://github.com/$GITHUB_REPOSITORY.git"
gh auth setup-git
if [ -n "$(git -C "$publish_root" ls-remote origin "refs/heads/$branch")" ]; then
git -C "$publish_root" fetch --depth 1 origin "$branch"
git -C "$publish_root" switch -C "$branch" FETCH_HEAD
fi
cp "$RUNNER_TEMP/catalog/catalog.json" "$RUNNER_TEMP/catalog/catalog.sig" "$publish_root/"
git -C "$publish_root" add catalog.json catalog.sig
git -C "$publish_root" -c user.name=github-actions -c user.email=41898282+github-actions[bot]@users.noreply.github.com commit -m "Publish official plugin catalog from $GITHUB_SHA"
git -C "$publish_root" push origin "HEAD:refs/heads/$branch"