-
Notifications
You must be signed in to change notification settings - Fork 13
139 lines (118 loc) · 4.23 KB
/
Copy pathrelease.yml
File metadata and controls
139 lines (118 loc) · 4.23 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
129
130
131
132
133
134
135
136
137
138
139
name: Release
on:
push:
branches:
- main
workflow_dispatch:
inputs:
release_target:
description: "What to release"
required: true
type: choice
default: "packages"
options:
- "packages"
- "vscode-extension"
extension_level:
description: "VS Code extension release level"
required: true
type: choice
default: "patch"
options:
- "patch"
- "minor"
- "major"
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Release
if: |
github.event_name == 'push' ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.release_target == 'packages')
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "24"
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
run: npm install
- name: Build packages
run: npm run build:packages
- name: Create Release PR or Publish
uses: changesets/action@v1
with:
publish: npm run publish-packages
commit: "chore: version packages"
title: "chore: version packages"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_CONFIG_PROVENANCE: "true"
release-vscode-extension:
name: Release VS Code Extension
if: github.event_name == 'workflow_dispatch' && github.event.inputs.release_target == 'vscode-extension'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "24"
- name: Install dependencies
run: npm install
- name: Set up git user
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
- name: Update schema
run: |
node ./scripts/getSchemas.js
git add packages/vscode-extension/assets/schema
git commit -m "chore(vscode-extension): update schemas" || true
- name: Bump extension version
run: |
cd packages/vscode-extension
npm version ${{ github.event.inputs.extension_level }} --no-git-tag-version
- name: Build dependency packages
run: npm run build:packages
- name: Build extension
run: npm run build -w pretext-tools
- name: Package extension
run: |
cd dist/vscode-extension
npx vsce package --no-dependencies
- name: Get extension version
id: version
run: echo "VERSION=$(jq -r '.version' packages/vscode-extension/package.json)" >> "$GITHUB_OUTPUT"
- name: Publish to VS Marketplace
run: |
cd dist/vscode-extension
npx vsce publish --no-dependencies -p "${{ secrets.VS_MARKETPLACE_TOKEN }}"
- name: Publish to Open VSX
run: |
cd dist/vscode-extension
npx ovsx publish --no-dependencies -p "${{ secrets.OPEN_VSX_TOKEN }}"
- name: Update changelog and commit release metadata
run: |
newline="\\n## [${{ steps.version.outputs.VERSION }}] - $(date +'%Y-%m-%d')"
sed '/## \[UNRELEASED\]/a\'"$newline" packages/vscode-extension/CHANGELOG.md > CHANGELOG.md.tmp
mv CHANGELOG.md.tmp packages/vscode-extension/CHANGELOG.md
git add packages/vscode-extension/CHANGELOG.md
git add packages/vscode-extension/package.json
git add package-lock.json
git commit -m "chore(vscode-extension): publish v${{ steps.version.outputs.VERSION }}" || true
git push origin main
- name: Create GitHub release for extension
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "vscode-extension-v${{ steps.version.outputs.VERSION }}" \
--repo="$GITHUB_REPOSITORY" \
--title="VS Code Extension v${{ steps.version.outputs.VERSION }}" \
--notes="See packages/vscode-extension/CHANGELOG.md for details."