-
Notifications
You must be signed in to change notification settings - Fork 0
123 lines (117 loc) · 3.67 KB
/
build.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Build
on:
workflow_dispatch:
concurrency:
group: build
cancel-in-progress: false
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
- name: Perform linting
run: |
npm install
npm run lint
build:
needs: test
name: Build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.REPO_ACCESS_TOKEN }}
-
name: Generate changelog
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
fromTag: ${{ github.ref_name }}
toTag: ${{ vars.TAG }}
writeToFile: false
reverseOrder: true
includeInvalidCommits: true
excludeTypes: "docs,build,chore"
-
name: Setup Git
run: |
git config user.name kroese
git config user.email kroese@users.noreply.github.com
git checkout -b release/v${{ vars.MAJOR }}.${{ vars.MINOR }}
-
name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
-
name: Build
run: |
sed -i "s/0.0.0-development/${{ vars.MAJOR }}.${{ vars.MINOR }}/" package.json
sed -i "s/0.0.0-development/${{ vars.MAJOR }}.${{ vars.MINOR }}/" package-lock.json
npm i -g @vercel/ncc
npm install --omit=dev
npm run build
#npm run build_stats
#npm exec --yes -- webpack-bundle-analyzer dist/stats dist -O -m static
-
name: Clean files
run: |
rm .gitignore
rm -f renovate.json
rm -Rf node_modules/
rm -Rf .github
rm index.js
rm -f dist/stats
rm -f dist/index.js.map
rm -f dist/index.873.js.map
rm -f dist/sourcemap-register.js
-
name: Create Branch release/v${{ vars.MAJOR }}.${{ vars.MINOR }}
run: |
git add .
git commit -m "Auto commit from Github Actions #${{ github.run_id }}"
git push origin release/v${{ vars.MAJOR }}.${{ vars.MINOR }} -f
-
name: Create a release
uses: action-pack/github-release@v2
with:
tag: "v${{ vars.MAJOR }}.${{ vars.MINOR }}"
title: "v${{ vars.MAJOR }}.${{ vars.MINOR }}"
commit: "release/v${{ vars.MAJOR }}.${{ vars.MINOR }}"
body: |
${{ steps.changelog.outputs.changes }}
**Full Changelog**: https://github.com/${{ github.repository }}/compare//${{ vars.TAG }}...v${{ vars.MAJOR }}.${{ vars.MINOR }}
token: ${{ secrets.REPO_ACCESS_TOKEN }}
-
name: Update major release
uses: action-pack/github-release@v2
with:
tag: "v${{ vars.MAJOR }}"
title: "v${{ vars.MAJOR }}"
commit: "release/v${{ vars.MAJOR }}.${{ vars.MINOR }}"
body: |
${{ steps.changelog.outputs.changes }}
**Full Changelog**: https://github.com/${{ github.repository }}/compare//${{ vars.TAG }}...v${{ vars.MAJOR }}.${{ vars.MINOR }}
token: ${{ secrets.REPO_ACCESS_TOKEN }}
-
name: Store tag
uses: action-pack/set-variable@v1
with:
name: 'TAG'
value: 'v${{ vars.MAJOR }}.${{ vars.MINOR }}'
token: ${{ secrets.REPO_ACCESS_TOKEN }}
-
name: Increment version variable
uses: action-pack/bump@v2
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}