-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (63 loc) · 2.54 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
54
55
56
57
58
59
60
61
62
63
64
65
name: Publish Extension
on:
push:
tags:
- 'v*.*.*'
jobs:
publish:
name: Publish Extension
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Setup Environment
run: node -e "console.log('PACKAGE_VERSION=' + require('./package.json').version + '\nPACKAGE_NAME=' + require('./package.json').name + '-' + require('./package.json').version)" >> $GITHUB_ENV # set PACKAGE_VERSION and PACKAGE_NAME
- name: Verify Version
run: node -e "if ('refs/tags/v' + '${{ env.PACKAGE_VERSION }}' !== '${{ github.ref }}') { console.log('::error' + 'Version Mismatch. refs/tags/v' + '${{ env.PACKAGE_VERSION }}', '${{ github.ref }}'); throw Error('Version Mismatch')} "
- name: Install Dependencies
run: |
npm install pnpm -g
pnpm install --no-frozen-lockfile
- name: Package Extension
run: pnpm run package
- name: Publish Extension
run: pnpm run publish --packagePath ./${{ env.PACKAGE_NAME }}.vsix --pat ${{ secrets.TSWAGGER_PERSONAL_ACCESS_TOKEN }}
- name: Generate Changelog
id: changelog
uses: mindsers/changelog-reader-action@v2
with:
version: ${{ env.PACKAGE_VERSION }}
path: ./CHANGELOG.md
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
name: v${{ env.PACKAGE_VERSION }}
body: ${{ steps.changelog.outputs.changes }}
draft: false
prerelease: false
files: ./${{ env.PACKAGE_NAME }}.vsix
- name: Dingtalk Notify
uses: zcong1993/actions-ding@master
with:
dingToken: ${{ secrets.DING_TALK_ACCESS_TOKEN}}
body: |
{
"msgtype": "markdown",
"markdown": {
"title":"👏👏 TSwagger Release Successful",
"text": "### vscode-tswagger \n\n**tswagger@${{ env.PACKAGE_VERSION }}** had been published. You can see it on the [market](https://marketplace.visualstudio.com/items?itemName=OrcaTeam.tswagger)(might take a few minutes). \n\n**These are the changes:**\n\n${{ steps.changelog.outputs.changes }}"
},
"at": {
"isAtAll": false
}
}