forked from jbetancur/react-data-table-component
-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (94 loc) · 3.1 KB
/
Copy pathrelease.yml
File metadata and controls
115 lines (94 loc) · 3.1 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
name: Release
on:
workflow_dispatch:
inputs:
bump:
description: Version bump type
required: true
type: choice
options:
- patch
- minor
- major
jobs:
lint-typecheck-test-build:
name: Lint, typecheck, test, build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint
- name: Typecheck
run: npm run typecheck
- name: Test
run: npm test
- name: Build
run: npm run build
release:
needs: lint-typecheck-test-build
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: 24
- name: Install dependencies
run: npm ci
- 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: |
VERSION=$(node -p "require('./package.json').version")
echo "value=$VERSION" >> $GITHUB_OUTPUT
echo "Bumped to $VERSION"
- name: Build
run: npm run build
- name: Check version not already published
run: |
VERSION="${{ steps.version.outputs.value }}"
if npm view react-data-table-component@$VERSION version 2>/dev/null; then
echo "Error: v$VERSION is already published to npm"
exit 1
fi
- name: Publish to npm
run: npm publish --provenance --access public --ignore-scripts
- name: Commit and tag
run: |
git add package.json CHANGELOG.md
git commit -m "chore: release v${{ steps.version.outputs.value }} [skip ci]"
git tag "v${{ steps.version.outputs.value }}"
git push origin HEAD:master --follow-tags
- name: Extract release notes from CHANGELOG.md
id: notes
run: |
VERSION="${{ steps.version.outputs.value }}"
# Extract everything between the ## X.Y.Z heading and the next --- or ## heading
NOTES=$(awk "/^## ${VERSION}$/{found=1; next} found && /^(---|## )/{exit} found{print}" CHANGELOG.md)
echo "content<<EOF" >> $GITHUB_OUTPUT
echo "$NOTES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create GitHub release
uses: softprops/action-gh-release@v3
with:
tag_name: v${{ steps.version.outputs.value }}
name: v${{ steps.version.outputs.value }}
body: |
${{ steps.notes.outputs.content }}
**Full changelog**: https://reactdatatable.com/docs/changelog
generate_release_notes: false