-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (106 loc) · 3.53 KB
/
Copy pathpublish.yml
File metadata and controls
126 lines (106 loc) · 3.53 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
name: Publish
on:
push:
tags:
- "v*.*.*"
permissions: {}
concurrency:
group: publish
cancel-in-progress: false
jobs:
build:
name: Build release artifact
runs-on: ubuntu-latest
outputs:
node-version: ${{ steps.node-version.outputs.version }}
npm_tag: ${{ steps.release.outputs.npm_tag }}
steps:
- name: Check out repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- name: Read Node.js version
id: node-version
run: echo "version=$(cat .node-version)" >> "$GITHUB_OUTPUT"
- name: Set up Vite+
uses: voidzero-dev/setup-vp@2dec1e33f4ab2c6d5bce1b0c4607961bb1a3f7a1 # v1
with:
version: 0.2.4
node-version: ${{ steps.node-version.outputs.version }}
sfw: true
cache: false
run-install: |
- args: ['--frozen-lockfile']
- name: Enable Corepack
run: corepack enable
- name: Resolve release metadata
id: release
run: |
package_version="$(node -p "require('./packages/mdx-marimo/package.json').version")"
expected_tag="v${package_version}"
if [[ "${GITHUB_REF_NAME}" != "${expected_tag}" ]]; then
echo "Tag ${GITHUB_REF_NAME} must match package version ${package_version}" >&2
exit 1
fi
if [[ "${package_version}" == *-* ]]; then
npm_tag="next"
else
npm_tag="latest"
fi
echo "npm_tag=${npm_tag}" >> "$GITHUB_OUTPUT"
- name: Check release
run: pnpm release:check
- name: Upload npm package
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: npm-package
path: dist/npm/marimo-team-mdx-marimo-*.tgz
retention-days: 1
if-no-files-found: error
permissions:
contents: read
publish:
name: Publish to npm
needs: build
runs-on: ubuntu-latest
environment:
name: npm
url: https://www.npmjs.com/org/marimo-team
permissions:
contents: read
id-token: write
steps:
- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: ${{ needs.build.outputs.node-version }}
registry-url: https://registry.npmjs.org
package-manager-cache: false
- name: Download npm package
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
with:
name: npm-package
path: dist/npm
- name: Publish mdx-marimo
run: npx --yes npm@11.12.1 publish --access public --tag "${{ needs.build.outputs.npm_tag }}" dist/npm/marimo-team-mdx-marimo-*.tgz
release-notes:
name: Update release notes
needs: publish
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with:
fetch-depth: 0
- name: Read Node.js version
id: node-version
run: echo "version=$(cat .node-version)" >> "$GITHUB_OUTPUT"
- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: ${{ steps.node-version.outputs.version }}
package-manager-cache: false
- name: Update release notes
run: npx changelogithub@14.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}