forked from jbetancur/react-data-table-component
-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (72 loc) · 2.41 KB
/
release.yml
File metadata and controls
87 lines (72 loc) · 2.41 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
name: Release
on:
workflow_dispatch:
inputs:
bump:
description: Version bump type
required: true
type: choice
options:
- patch
- minor
- major
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Bump version
run: npm version ${{ inputs.bump }} --no-git-tag-version
- name: Get new version
id: version
run: echo "value=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Build
run: npm run build
- name: Publish to npm
run: npm publish --provenance --access public
- name: Commit and tag
run: |
git add package.json
git commit -m "chore: release v${{ steps.version.outputs.value }}"
git tag "v${{ steps.version.outputs.value }}"
git push origin HEAD:master --follow-tags
- name: Generate release notes
id: notes
run: |
PREV_TAG=$(git describe --tags --abbrev=0 HEAD~1 2>/dev/null || echo "")
if [ -z "$PREV_TAG" ]; then
NOTES=$(git log --pretty=format:"- %s" | head -30)
else
NOTES=$(git log "$PREV_TAG"..HEAD~1 --pretty=format:"- %s")
fi
echo "content<<EOF" >> $GITHUB_OUTPUT
echo "$NOTES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version.outputs.value }}
name: v${{ steps.version.outputs.value }}
body: |
## What's Changed
${{ steps.notes.outputs.content }}
**Full changelog**: https://github.com/${{ github.repository }}/compare/${{ steps.version.outputs.value }}...v${{ steps.version.outputs.value }}
generate_release_notes: false