-
Notifications
You must be signed in to change notification settings - Fork 2
53 lines (53 loc) · 1.61 KB
/
publish.yml
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
name: Publish to VSCode Store
on:
push:
tags:
- '*'
# release:
# types:
# - published
workflow_dispatch:
jobs:
package-publish:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm i -g @vscode/vsce pnpm ovsx
- name: Cache dependencies
uses: actions/cache@v4
id: cache
with:
path: |
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pnpm i --frozen-lockfile --ignore-scripts
- name: Publish
env:
VSCODE_PUBLISH_TOKEN: ${{ secrets.VSCODE_PUBLISH_TOKEN }}
OPENVSX_PUBLISH_TOKEN: ${{ secrets.OPENVSX_PUBLISH_TOKEN }}
run: |
vsce package --no-dependencies
vsce publish --no-dependencies -p $VSCODE_PUBLISH_TOKEN
ovsx publish --no-dependencies -p $OPENVSX_PUBLISH_TOKEN
# - name: Upload assets
# uses: softprops/action-gh-release@v1
# if: startsWith(github.ref, 'refs/tags/')
# with:
# files: '*.vsix'
- run: |
# 使用sed命令提取最新的版本记录
cat CHANGELOG.md | awk '/^# \[/ {if (flag) exit; flag=1} flag {print}' > body.md
- name: Publish release
uses: ncipollo/release-action@v1
with:
artifacts: '*.vsix'
bodyFile: 'body.md'