Repository navigation
76 lines (66 loc) · 2.8 KB
/
Copy pathrelease-node-sdk.yml
File metadata and controls
76 lines (66 loc) · 2.8 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
# Releases the official Node.js plugin SDK (`sdk/node`) through its own tag
# series (`sdk-node-v<version>`). The release holds
# `lithe-plugin-sdk-node-<version>.tgz` and its `.sha256`; plugin repositories
# pin both and vendor the unpacked package into their backend at build time,
# because an installed plugin has no `node_modules` install step.
name: Release Node Plugin SDK
on:
push:
tags:
- "sdk-node-v*"
permissions:
contents: read
concurrency:
group: release-node-plugin-sdk-${{ github.ref }}
cancel-in-progress: false
jobs:
release:
name: Release ${{ github.ref_name }}
if: github.repository == 'Lithe-IDEA/lithe-plugin-docs'
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
steps:
- name: Check out source
uses: actions/checkout@v7
# The SDK supports Node.js 20.3 and newer, so the release is tested on
# the oldest supported major.
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 20
- name: Require the tag to match the SDK version
id: version
env:
TAG: ${{ github.ref_name }}
run: |
version=$(node -p "require('./sdk/node/package.json').version")
test "$TAG" = "sdk-node-v$version" || { echo "Tag $TAG does not match sdk/node version $version"; exit 1; }
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Test
run: node --test sdk/node/test/*.test.mjs
# `npm pack` only builds the archive; `private: true` still keeps the
# SDK off the npm registry. The repository LICENSE is copied in so the
# archive carries its own license text.
- name: Collect the release assets
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
mkdir -p dist
cp LICENSE sdk/node/LICENSE
(cd sdk/node && npm pack --pack-destination ../../dist)
asset="lithe-plugin-sdk-node-$VERSION.tgz"
mv "dist/lithe-plugin-sdk-$VERSION.tgz" "dist/$asset"
tar -tzf "dist/$asset" | sort
(cd dist && sha256sum "$asset" | cut -d' ' -f1 > "$asset.sha256")
- name: Publish the SDK release
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.ref_name }}
VERSION: ${{ steps.version.outputs.version }}
run: |
asset="lithe-plugin-sdk-node-$VERSION.tgz"
gh release create "$TAG" "dist/$asset" "dist/$asset.sha256" \
--title "Node.js plugin SDK $VERSION" \
--notes "Official Node.js plugin SDK $VERSION for Lithe plugin backends. Requires Node.js 20.3 or newer and has no dependencies. Pin the archive by its SHA-256 (\`$asset.sha256\`), unpack it, and vendor its \`package/\` directory into the plugin package; see sdk/node/README.md."