-
Notifications
You must be signed in to change notification settings - Fork 5
92 lines (77 loc) · 2.83 KB
/
deploy.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
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
name: Continuous Deployment
on:
workflow_dispatch:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install
run: npm ci
- name: Lint
run: npm run lint
- name: Test
run: npm run test
- name: Set up publishing
run: |
npm install vsce --save-dev
npm install ovsx --save-dev
- name: Publish
run: npm run deploy
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
- name: Create OVSX Package
run: npx vsce package --out package.vsix
- name: Publish OVSX Package
run: |
npx ovsx publish package.vsix --pat ${{ secrets.OVSX_PAT }}
- name: Read package.json
id: package-json
run: |
content=`cat ./package.json`
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
echo "::set-output name=packageJson::$content"
- name: Get Changelog
id: changelog
run: |
version=${{fromJson(steps.package-json.outputs.packageJson).version}}
escaped_version=$(printf '%s\n' "$version" | sed -e 's/[]\/$*.^[]/\\&/g')
changelog=`sed -n "/^## \[$escaped_version]/,/^## /p" CHANGELOG.md | sed '$ d' | sed '1,1d'`
changelog1="${changelog//'%'/'%25'}"
changelog1="${changelog1//$'\n'/'%0A'}"
changelog1="${changelog1//$'\r'/'%0D'}"
changelog2="${changelog//$'\n'/'\\n'}"
changelog2="${changelog2//$'\r'/'\\r'}"
changelog2="${changelog2//$'('/'\('}"
changelog2="${changelog2//$')'/'\)'}"
changelog2="${changelog2//$'`'/'\`'}"
changelog2="${changelog2//$'"'/'\"'}"
changelog2="${changelog2//"'"/"'\''"}"
echo "::set-output name=escaped::$changelog"
echo "::set-output name=unescaped::$changelog1"
echo "::set-output name=doubleescaped::$changelog2"
- name: Github Release
id: release
uses: softprops/action-gh-release@v1
with:
body: "${{steps.changelog.outputs.unescaped}}"
tag_name: "${{fromJson(steps.package-json.outputs.packageJson).version}}"
- name: Prepare Discord Message
id: discord-msg
run: |
awk '{
gsub("#VERSION#","${{fromJson(steps.package-json.outputs.packageJson).version}}",$0);
gsub("#DESCRIPTION#","${{steps.changelog.outputs.doubleescaped}}",$0);
gsub("#URL#","${{steps.release.outputs.url}}",$0);
print $0;
}' ./.github/workflows/deploy_discord_message.json > ./.github/workflows/deploy_discord_message2.json
- name: Send Discord Message
uses: tsickert/[email protected]
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
raw-data: "./.github/workflows/deploy_discord_message2.json"