Repository navigation
78 lines (74 loc) · 2.42 KB
/
Copy pathrelease.yml
File metadata and controls
78 lines (74 loc) · 2.42 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
name: Release
on:
push:
tags: ["v*"]
workflow_dispatch:
inputs:
tag:
description: Release tag, for example v0.8.0
required: true
type: string
permissions:
contents: read
jobs:
verify:
uses: ./.github/workflows/ci.yml
publish:
needs: verify
runs-on: ubuntu-latest
environment:
name: npm
url: https://www.npmjs.com/package/edstem-cli
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }}
- uses: actions/setup-node@v5
with:
node-version: 22
cache: npm
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- run: npm ci
- name: Verify tag and package version
env:
RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
run: |
node - <<'JS'
const pkg = require("./package.json");
const expected = `v${pkg.version}`;
if (pkg.name !== "edstem-cli") throw new Error(`Unexpected package name: ${pkg.name}`);
if (process.env.RELEASE_TAG !== expected) throw new Error(`${process.env.RELEASE_TAG} does not match ${expected}`);
JS
- run: npm run check
- run: npm test
- run: npm run build
- run: npm run pack:check
- run: npm run pack:smoke
- name: Check generated skill
run: |
npm run skill:generate
git diff --exit-code SKILL.md
- name: Check npm publication state
id: npm
run: |
if npm view "edstem-cli@$(node -p 'require("./package.json").version')" version >/dev/null 2>&1; then
echo "published=true" >> "$GITHUB_OUTPUT"
else
echo "published=false" >> "$GITHUB_OUTPUT"
fi
- name: Install npm with trusted publishing support
if: steps.npm.outputs.published != 'true'
run: npm install --global npm@12.0.1
- name: Publish npm package
if: steps.npm.outputs.published != 'true'
run: npm publish --access public --provenance
- name: Publish GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
body_path: .github/release-notes/0.8.0.md