6
6
jobs :
7
7
publish-patch :
8
8
runs-on : ubuntu-latest
9
- defaults :
10
- run :
11
- working-directory : library
12
9
13
10
steps :
14
11
- uses : actions/checkout@v4
@@ -17,20 +14,28 @@ jobs:
17
14
18
15
- uses : actions/setup-node@v4
19
16
with :
20
- node-version : 22
17
+ node-version : 22.14.0
21
18
registry-url : https://registry.npmjs.org/
22
19
23
- - name : Install dependencies in root
20
+ - name : Set correct npm version
21
+ run :
npm install -g [email protected]
22
+
23
+ - name : Install all workspace dependencies
24
24
run : npm install
25
- working-directory : ..
25
+ working-directory : .
26
26
27
27
- name : Bump Minor version and create branch
28
28
run : |
29
+ cd library
30
+
29
31
# Bump version in library/package.json
30
32
npm version preminor --no-git-tag-version --preid=alpha > /dev/null
31
33
new_version=$(node -p "require('./package.json').version")
32
34
echo "New version: $new_version"
33
35
36
+ # Go back to the root directory
37
+ cd ..
38
+
34
39
# Create and checkout new branch
35
40
branch_name="chore/version-bump-minor-${new_version}"
36
41
git checkout -b "$branch_name"
@@ -39,29 +44,23 @@ jobs:
39
44
git config user.name "github-actions"
40
45
git config user.email "[email protected] "
41
46
42
- # Add package.json from library and package-lock.json from root
43
- files_to_add="package.json"
44
- root_package_lock="../package-lock.json"
45
- if [ -f "$root_package_lock" ]; then
46
- files_to_add="$files_to_add $root_package_lock"
47
- else
48
- echo "Warning: $root_package_lock not found in root directory"
49
- fi
50
- git add $files_to_add
51
- git commit -m "chore(release): bump preminor version to $new_version"
47
+ # Add updated files
48
+ git add library/package.json package-lock.json
52
49
53
- # Push new branch
50
+ git commit -m "chore(release): bump preminor version to $new_version"
54
51
git push origin "$branch_name"
55
52
56
- # Store branch name and version for next steps
53
+ # Set outputs
57
54
echo "BRANCH_NAME=$branch_name" >> $GITHUB_ENV
58
55
echo "NEW_VERSION=$new_version" >> $GITHUB_ENV
59
56
60
- - name : Build
57
+ - name : Build library
61
58
run : npm run build
59
+ working-directory : library
62
60
63
61
- name : Publish to npm
64
62
run : npm publish --access public --tag latest
63
+ working-directory : library
65
64
env :
66
65
NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
67
66
0 commit comments