-
Notifications
You must be signed in to change notification settings - Fork 1
75 lines (58 loc) · 2.21 KB
/
publish-library-minor.yaml
File metadata and controls
75 lines (58 loc) · 2.21 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
name: Publish Library Minor Version
on:
workflow_dispatch:
jobs:
publish-minor:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
token: ${{ secrets.GITHUB_TOKEN }} # Needed for pushing changes and creating PR
- uses: actions/setup-node@v6
with:
node-version: 24.14.0
registry-url: https://registry.npmjs.org/
- name: Set correct npm version
run: npm install -g npm@11.1.0
- name: Install all workspace dependencies
run: npm install
working-directory: .
- name: Bump Minor version and create branch
run: |
cd library
# Bump version in library/package.json
npm version preminor --no-git-tag-version --preid=alpha > /dev/null
new_version=$(node -p "require('./package.json').version")
echo "New version: $new_version"
# Go back to the root directory
cd ..
# Create and checkout new branch
branch_name="chore/version-bump-minor-${new_version}"
git checkout -b "$branch_name"
# Configure git
git config user.name "github-actions"
git config user.email "github-actions@github.com"
# Add updated files
git add library/package.json package-lock.json
git commit -m "chore(release): bump preminor version to $new_version"
git push origin "$branch_name"
# Set outputs
echo "BRANCH_NAME=$branch_name" >> $GITHUB_ENV
echo "NEW_VERSION=$new_version" >> $GITHUB_ENV
- name: Build library
run: npm run build
working-directory: library
- name: Publish to npm
run: npm publish --access public --tag latest
working-directory: library
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create Pull Request
run: |
gh pr create \
--base main \
--head "${{ env.BRANCH_NAME }}" \
--title "chore: bump minor version to ${{ env.NEW_VERSION }}" \
--body "Automated version bump to ${{ env.NEW_VERSION }} and npm publish with alpha tag"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}