@@ -6,11 +6,14 @@ name: NPM Publish
66on :
77 # Triggers the workflow on push or pull request events but only for the main branch
88 push :
9- branches : ['**']
9+ branches : " ** "
1010
1111 # Allows you to run this workflow manually from the Actions tab
1212 workflow_dispatch :
1313
14+ env :
15+ BRANCH_NAME : ${{ github.ref_name }}
16+
1417# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1518jobs :
1619 # This workflow contains a single job called "release"
1922 if : " !contains(github.event.head_commit.message, '[skip ci]')"
2023 steps :
2124 - name : Checkout
22- uses : actions/checkout@v2
25+ uses : actions/checkout@v4
2326 with :
2427 persist-credentials : false
2528 - run : npm ci
@@ -34,12 +37,20 @@ jobs:
3437 # Steps represent a sequence of tasks that will be executed as part of the job
3538 steps :
3639 - name : Checkout
37- uses : actions/checkout@v2
40+ uses : actions/checkout@v4
3841 with :
3942 persist-credentials : true
4043 token : ${{ secrets.PIPELINE_BOT_PAT }}
44+
45+ - uses : actions/setup-node@v4
46+ with :
47+ node-version : 20
48+ cache : " npm"
49+
4150 - run : npm ci
51+
4252 - name : Semantic Release
53+ id : semantic-release
4354 env :
4455 GITHUB_TOKEN : ${{ secrets.PIPELINE_BOT_PAT }}
4556 GH_TOKEN : ${{ secrets.PIPELINE_BOT_PAT }}
4960 GIT_COMMITTER_NAME : im-pipeline-bot
5061 GIT_COMMITTER_EMAIL : ${{ secrets.COMMITBOT_EMAIL }}
5162 run : npx semantic-release
63+
64+ - name : Comment on PR
65+ if : env.BRANCH_NAME != 'main'
66+ env :
67+ NEXT_VERSION : ${{ steps.semantic-release.outputs.NEXT_VERSION }}
68+ 69+ with :
70+ github-token : ${{ secrets.PIPELINE_BOT_PAT }}
71+ comment-identifier : " publish-comment" # this should not change
72+ pr-ref : ${{ github.sha }}
73+ comment-content : |
74+ This PR is part of this prerelease version for testing: **${{ env.NEXT_VERSION }}**
75+
76+ You can test it by using:
77+ ```bash
78+ npm install scriptloader-component@${{ env.NEXT_VERSION }}
79+ ```
0 commit comments