@@ -3,9 +3,9 @@ name: Lerna Versioning and Publish
3
3
on :
4
4
push :
5
5
branches :
6
- - main # Trigger on push to the main branch
6
+ - main
7
7
tags :
8
- - ' v*' # Trigger on version tags (e.g., v1.0.0)
8
+ - ' v*'
9
9
10
10
jobs :
11
11
versioning-and-publishing :
@@ -32,18 +32,42 @@ jobs:
32
32
git config --global user.name "GitHub Actions"
33
33
git config --global user.email "github-actions[bot]@users.noreply.github.com"
34
34
35
- - name : Run Lerna Version
35
+ - name : Run Lerna Version and Capture Tag
36
+ id : version
36
37
run : |
37
- npx lerna version --conventional-commits --yes # Auto version bump based on commit messages
38
+ # Save current tags before running lerna version
39
+ git tag > before_tags.txt
40
+
41
+ # Run lerna version (will only bump if relevant commits exist)
42
+ npx lerna version --conventional-commits --yes --no-push
43
+
44
+ # Save tags after lerna version
45
+ git tag > after_tags.txt
46
+
47
+ # Compare tags before and after
48
+ if diff before_tags.txt after_tags.txt > /dev/null; then
49
+ echo "published=false" >> $GITHUB_OUTPUT
50
+ else
51
+ echo "published=true" >> $GITHUB_OUTPUT
52
+ fi
38
53
39
54
- name : Publish to npm
55
+ if : steps.version.outputs.published == 'true'
40
56
run : |
41
- npx lerna publish from-package --yes # Publish the updated packages to npm
42
-
57
+ npx lerna publish from-package --yes
43
58
env :
44
59
NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
45
60
46
61
- name : Push commit and tag
62
+ if : steps.version.outputs.published == 'true'
47
63
run : |
48
- git push origin main # Push the version bump commit to main
49
- git push origin --tags # Push the new tag created by lerna version
64
+ git push origin main
65
+ git push origin --tags
66
+
67
+ - name : Dispatch to Other Repo
68
+ if : steps.version.outputs.published == 'true'
69
+ uses : peter-evans/repository-dispatch@v2
70
+ with :
71
+ token : ${{ secrets.GITHUB_TOKEN }}
72
+ repository : SteamClientHomebrew/SteamBrew
73
+ event-type : on-millennium-sdk-updated
0 commit comments