-
-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (93 loc) · 3.52 KB
/
release.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
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Release Plugins
on:
push:
tags:
- 'v*.*.*'
paths-ignore:
- 'README.md'
- 'docs/**'
- '.vscode'
pull_request:
branches:
- master
paths-ignore:
- 'docs/**'
- 'README.md'
- '.vscode'
concurrency:
group: release-ci-group
cancel-in-progress: true
jobs:
Plugins:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- id: setPluginInfoJSON
run: |
content=`cat ./src/plugin.info`
# the following lines are only required for multi line json
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
# here we replace "title": "$:/plugins/linonetwo/tw-example-plugin", to "title": "linonetwo/tw-example-plugin",
# so it can be used in tiddly-gittly/tw5-plugin-packer to find output path
content="${content//$\:\/plugins\//}"
# end of optional handling for multi line json
echo "::set-output name=pluginInfoJSON::$content"
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
**/node_modules
~/.pnpm-store
~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
${{ runner.os }}-node-
- name: Install Dependencies
run: npm install -g pnpm && pnpm install
- name: Make Plugins
run: pnpm run make && pnpm run download-react
env:
CI: true
CI_PULL_REQUEST: ${{ github.event_name == 'pull_request' }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# this should be the same as `scripts/run-action.mjs`
- uses: tiddly-gittly/tw5-plugin-packer@v0.0.10
with:
minify: 'true'
# here we read plugin author and name from pluginInfoJSON, and pluginInfoJSON is read in the step above with id `setPluginInfoJSON`
source: 'dist/plugins/${{fromJson(steps.setPluginInfoJSON.outputs.pluginInfoJSON).title}}'
output: 'dist/out'
uglifyjs-options: '{ "warnings": false, "ie8": false, "safari10": false }'
cleancss-options: '{ "compatibility": "*", "level": 2 }'
# build dev channel
- uses: tiddly-gittly/tw5-plugin-packer@v0.0.10
with:
minify: 'true'
# here we read plugin author and name from pluginInfoJSON, and pluginInfoJSON is read in the step above with id `setPluginInfoJSON`
source: 'dist/plugins/${{fromJson(steps.setPluginInfoJSON.outputs.pluginInfoJSON).title}}-dev'
output: 'dist/out-dev'
uglifyjs-options: '{ "warnings": false, "ie8": false, "safari10": false }'
cleancss-options: '{ "compatibility": "*", "level": 2 }'
- name: mv dev to output
run: npx zx ./scripts/mv-dev.mjs
- name: Make Demo Site
run: npx zx ./scripts/build-demo-html.mjs
- name: Create Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
dist/out/*.json
dist/out/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# location is described in ./scripts/build-demo-html.mjs
publish_dir: ./dist/output