generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 11
50 lines (40 loc) · 1.49 KB
/
prerelease.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
name: Create Prerelease Branch and Publish to npm
on:
workflow_dispatch:
jobs:
create-prerelease:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install dependencies
run: npm install
- name: Bump version to prerelease
id: bump_version
run: |
CURRENT_VERSION=$(node -p "require('./package.json').version")
PRERELEASE_VERSION=$(npm version prerelease --preid=beta)
echo "Current version: $CURRENT_VERSION"
echo "Prerelease version: $PRERELEASE_VERSION"
echo "::set-output name=prerelease_version::$PRERELEASE_VERSION"
- name: Modify CHANGELOG.md
run: |
echo "## Prerelease Version\n\nThis is a prerelease version.\n\n$(cat CHANGELOG.md)" > CHANGELOG.md
- name: Create new branch and push changes
run: |
BRANCH_NAME="prerelease-${{ steps.bump_version.outputs.prerelease_version }}"
git checkout -b $BRANCH_NAME
git push origin $BRANCH_NAME
git push --tags
- name: Publish to npm
run: npm publish --tag beta --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Delete branch
run: |
BRANCH_NAME="prerelease-${{ steps.bump_version.outputs.prerelease_version }}"
git push origin --delete $BRANCH_NAME