-
Notifications
You must be signed in to change notification settings - Fork 3
56 lines (47 loc) · 1.43 KB
/
node.js.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
name: Build and Release
on:
push:
branches:
- what-is-the-tsc-say
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Get the latest commit message
id: get_latest_commit
run: |
latest_commit=$(git log -1 --pretty=format:%s)
echo "latest_commit_message=$latest_commit" >> $GITHUB_ENV
- name: Read changelog
id: read_changelog
run: |
changelog=$(< CHANGELOG.md)
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
echo "$changelog" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Set up Node.js
if: startsWith(env.latest_commit_message, 'v')
uses: actions/setup-node@v3
with:
node-version: '22'
- name: npm run build
if: startsWith(env.latest_commit_message, 'v')
run: npm i
- name: npm run build
if: startsWith(env.latest_commit_message, 'v')
run: npm run build
- name: Release
uses: softprops/action-gh-release@v1
# Check if commit message starts with 'v'
if: startsWith(env.latest_commit_message, 'v')
with:
tag_name: ${{ github.ref }}
name: Release ${{ env.latest_commit_message }}
body: ${{ env.CHANGELOG }}
draft: false
prerelease: false
files: build/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}