-
-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (48 loc) · 1.45 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
name: Release
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Generate Release Notes
id: generate_notes
run: |
# Get the latest tag
LATEST_TAG=$(git describe --tags --abbrev=0)
# Get the previous tag
PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || git rev-list --max-parents=0 HEAD)
# Generate changelog
if [ "$PREVIOUS_TAG" = "$(git rev-list --max-parents=0 HEAD)" ]; then
CHANGELOG=$(git log --pretty=format:"- %s" $PREVIOUS_TAG..$LATEST_TAG)
else
CHANGELOG=$(git log --pretty=format:"- %s" $PREVIOUS_TAG..$LATEST_TAG)
fi
# Save changelog to file
echo "$CHANGELOG" > changelog.md
- name: Create Release
uses: softprops/action-gh-release@v1
with:
body_path: changelog.md
draft: true
files: |
main.js
manifest.json
styles.css
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}