-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (128 loc) · 4.03 KB
/
build.yml
File metadata and controls
133 lines (128 loc) · 4.03 KB
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
124
125
126
127
128
129
130
131
132
133
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@v6
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@v6
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@v6
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
#rm -f 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 -Rf test
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 }}"
token: ${{ secrets.REPO_ACCESS_TOKEN }}
commit: "release/v${{ vars.MAJOR }}.${{ vars.MINOR }}"
body: |
${{ steps.changelog.outputs.changes }}
-
name: Update major release
uses: action-pack/github-release@v2
with:
tag: "v${{ vars.MAJOR }}"
title: "v${{ vars.MAJOR }}"
token: ${{ secrets.REPO_ACCESS_TOKEN }}
commit: "release/v${{ vars.MAJOR }}.${{ vars.MINOR }}"
body: |
${{ steps.changelog.outputs.changes }}
-
name: Store tag
uses: action-pack/set-variable@v1
with:
name: 'TAG'
token: ${{ secrets.REPO_ACCESS_TOKEN }}
value: 'v${{ vars.MAJOR }}.${{ vars.MINOR }}'
-
name: Increment version variable
uses: action-pack/bump@v2
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
-
name: Send mail
uses: action-pack/send-mail@v1
with:
to: ${{secrets.MAILTO}}
from: Github Actions <${{secrets.MAILTO}}>
connection_url: ${{secrets.MAIL_CONNECTION}}
subject: Build of ${{ github.event.repository.name }} v${{ vars.MAJOR }}.${{ vars.MINOR }} completed
body: |
The build job of ${{ github.event.repository.name }} v${{ vars.MAJOR }}.${{ vars.MINOR }} was completed successfully!
See https://github.com/${{ github.repository }}/actions for more information.