Skip to content

Commit 3d42c8e

Browse files
committed
Add build release script.
1 parent 6350526 commit 3d42c8e

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Build Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*"
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
defaults:
14+
run:
15+
shell: bash
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-22.04
20+
timeout-minutes: 10
21+
permissions:
22+
contents: write
23+
pull-requests: read
24+
env:
25+
RELEASE_ZIP_FILENAME: ${{ github.event.repository.name }}-${{ github.ref_name }}.zip
26+
RELEASE_TAR_GZ_FILENAME: ${{ github.event.repository.name }}-${{ github.ref_name }}.tar.gz
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
30+
31+
- name: Set up Node.js
32+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
33+
with:
34+
node-version: "18.19.x"
35+
36+
- name: Install dependencies
37+
run: yarn
38+
39+
- name: Build
40+
run: yarn build
41+
42+
- name: "Build Changelog"
43+
id: build_changelog
44+
uses: requarks/changelog-action@4a2c34a1a8fcfa9e48e61960aad0affc15066393
45+
with:
46+
tag: ${{ github.ref_name }}
47+
token: ${{ secrets.GITHUB_TOKEN }}
48+
writeToFile: false
49+
includeInvalidCommits: true
50+
51+
- name: Create Zip Archive
52+
run: |
53+
echo "::start:: Creating zip archive..."
54+
(cd dist && \
55+
zip \
56+
-r ../$RELEASE_ZIP_FILENAME . \
57+
-x "node_modules/*" "*/node_modules/*" \
58+
$(test -f ../.releaseignore && echo "-x@../.releaseignore")\
59+
)
60+
echo "::end:: Created zip archive."
61+
62+
- name: Create Tar Gz Archive
63+
run: |
64+
echo "::start:: Creating tar.gz archive..."
65+
(cd dist && \
66+
tar \
67+
-czv -f ../$RELEASE_TAR_GZ_FILENAME \
68+
--exclude "node_modules/*" \
69+
--exclude "*/node_modules/*" \
70+
$(test -f ../.releaseignore && echo "--exclude-from ../.releaseignore") \
71+
.
72+
)
73+
echo "::end:: Created tar.gz archive."
74+
75+
- name: Create the release
76+
uses: softprops/action-gh-release@4634c16e79c963813287e889244c50009e7f0981
77+
with:
78+
files: |
79+
${{ env.RELEASE_ZIP_FILENAME }}
80+
${{ env.RELEASE_TAR_GZ_FILENAME }}
81+
body: ${{ steps.build_changelog.outputs.changes }}

0 commit comments

Comments
 (0)