@@ -13,7 +13,27 @@ permissions:
1313 id-token : write
1414
1515jobs :
16- build_and_publish :
16+ changes :
17+ name : Detect changed packages
18+ runs-on : ubuntu-latest
19+ outputs :
20+ sdk : ${{ steps.filter.outputs.sdk }}
21+ cli : ${{ steps.filter.outputs.cli }}
22+ steps :
23+ - uses : actions/checkout@v4
24+ - id : filter
25+ uses : dorny/paths-filter@v3
26+ with :
27+ filters : |
28+ sdk:
29+ - 'packages/genesys-cloud-chatbot-tester/package.json'
30+ cli:
31+ - 'packages/genesys-cloud-chatbot-tester-cli/package.json'
32+
33+ publish_sdk :
34+ name : Publish genesys-cloud-chatbot-tester
35+ needs : changes
36+ if : needs.changes.outputs.sdk == 'true'
1737 runs-on : ubuntu-latest
1838
1939 steps :
@@ -25,16 +45,17 @@ jobs:
2545 node-version-file : " .nvmrc"
2646 registry-url : ' https://registry.npmjs.org'
2747 scope : ' @makingchatbots'
48+ cache : ' npm'
2849
2950 - name : Install dependencies
30- run : npm install
51+ run : npm ci
3152
3253 - name : Build
3354 run : |
3455 npm run clean
3556 npm run build
3657
37- - id : publish_sdk
58+ - id : publish
3859 name : Publish genesys-cloud-chatbot-tester
3960 uses : JS-DevTools/npm-publish@v3
4061 with :
@@ -44,84 +65,109 @@ jobs:
4465 provenance : true
4566 access : public
4667
47- - id : publish_cli
48- name : Publish genesys-cloud-chatbot-tester-cli
49- uses : JS-DevTools/npm-publish@v3
50- with :
51- package : packages/genesys-cloud-chatbot-tester-cli
52- token : ${{ secrets.NPM_TOKEN }}
53- dry-run : false
54- provenance : true
55- access : public
56-
57- - name : Post-publish genesys-cloud-chatbot-tester
58- if : steps.publish_sdk.outputs.type != 'none'
59- run : echo "Published genesys-cloud-chatbot-tester ${{ steps.publish_sdk.outputs.version }}"
60-
61- - name : Post-publish genesys-cloud-chatbot-tester-cli
62- if : steps.publish_cli.outputs.type != 'none'
63- run : echo "Published genesys-cloud-chatbot-tester-cli ${{ steps.publish_cli.outputs.version }}"
68+ - name : Post-publish
69+ if : steps.publish.outputs.type != 'none'
70+ run : echo "Published genesys-cloud-chatbot-tester ${{ steps.publish.outputs.version }}"
6471
65- - name : Configure changelog for genesys-cloud-chatbot-tester
66- if : steps.publish_sdk .outputs.type != 'none'
72+ - name : Configure changelog
73+ if : steps.publish .outputs.type != 'none'
6774 run : |
6875 echo '{"categories": [], "template": "## Commits:\n\n${{ '${{UNCATEGORIZED}}' }}", "pr_template": ${{ '"- ${{MERGE_SHA}} ${{TITLE}}"' }} }' > changelog_config.json
69- echo "last_tag=$(git describe --tags --match \" genesys-cloud-chatbot-tester-v*\" --abbrev=0)" >> $GITHUB_ENV
76+ echo "last_tag=$(git describe --tags --match ' genesys-cloud-chatbot-tester-v*' --abbrev=0)" >> $GITHUB_ENV
7077 echo "curr_commit=$(git rev-parse HEAD)" >> $GITHUB_ENV
7178
72- - name : Generate changelog for genesys-cloud-chatbot-tester
73- if : steps.publish_sdk .outputs.type != 'none'
74- id : changelog_tester
79+ - name : Generate changelog
80+ if : steps.publish .outputs.type != 'none'
81+ id : changelog
75827683 env :
7784 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
7885 with :
7986 fromTag : " ${{ env.last_tag }}"
80- toTag : ${{ github.ref }}
87+ toTag : ${{ github.sha }}
8188 commitMode : true
8289 configuration : changelog_config.json
8390
84- - name : Create release for genesys-cloud-chatbot-tester
85- if : steps.publish_sdk .outputs.type != 'none'
91+ - name : Create GitHub release
92+ if : steps.publish .outputs.type != 'none'
8693 uses : actions/create-release@v1
8794 env :
8895 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
8996 with :
90- tag_name : genesys-cloud-chatbot-tester-v${{ steps.publish_sdk .outputs.version }}
91- release_name : genesys-cloud-chatbot-tester-v${{ steps.publish_sdk .outputs.version }}
92- commitish : ${{ github.ref }}
93- body : ${{ steps.changelog_tester .outputs.changelog }}
97+ tag_name : genesys-cloud-chatbot-tester-v${{ steps.publish .outputs.version }}
98+ release_name : genesys-cloud-chatbot-tester-v${{ steps.publish .outputs.version }}
99+ commitish : ${{ github.sha }}
100+ body : ${{ steps.changelog .outputs.changelog }}
94101 draft : false
95102 prerelease : false
96103
97- - name : Configure changelog for genesys-cloud-chatbot-tester-cli
98- if : steps.publish_cli.outputs.type != 'none'
104+ publish_cli :
105+ name : Publish genesys-cloud-chatbot-tester-cli
106+ needs : changes
107+ if : needs.changes.outputs.cli == 'true'
108+ runs-on : ubuntu-latest
109+
110+ steps :
111+ - uses : actions/checkout@v4
112+
113+ - name : Set up Node
114+ uses : actions/setup-node@v4
115+ with :
116+ node-version-file : " .nvmrc"
117+ registry-url : ' https://registry.npmjs.org'
118+ scope : ' @makingchatbots'
119+ cache : ' npm'
120+
121+ - name : Install dependencies
122+ run : npm ci
123+
124+ - name : Build
125+ run : |
126+ npm run clean
127+ npm run build
128+
129+ - id : publish
130+ name : Publish genesys-cloud-chatbot-tester-cli
131+ uses : JS-DevTools/npm-publish@v3
132+ with :
133+ package : packages/genesys-cloud-chatbot-tester-cli
134+ token : ${{ secrets.NPM_TOKEN }}
135+ dry-run : false
136+ provenance : true
137+ access : public
138+
139+ - name : Post-publish
140+ if : steps.publish.outputs.type != 'none'
141+ run : echo "Published genesys-cloud-chatbot-tester-cli ${{ steps.publish.outputs.version }}"
142+
143+ - name : Configure changelog
144+ if : steps.publish.outputs.type != 'none'
99145 run : |
100146 echo '{"categories": [], "template": "## Commits:\n\n${{ '${{UNCATEGORIZED}}' }}", "pr_template": ${{ '"- ${{MERGE_SHA}} ${{TITLE}}"' }} }' > changelog_config.json
101- echo "last_tag=$(git describe --tags --match \" genesys-cloud-chatbot-tester-cli-v*\" --abbrev=0)" >> $GITHUB_ENV
147+ echo "last_tag=$(git describe --tags --match ' genesys-cloud-chatbot-tester-cli-v*' --abbrev=0)" >> $GITHUB_ENV
102148 echo "curr_commit=$(git rev-parse HEAD)" >> $GITHUB_ENV
103149
104- - name : Generate changelog for genesys-cloud-chatbot-tester-cli
105- if : steps.publish_cli .outputs.type != 'none'
106- id : changelog_cli
150+ - name : Generate changelog
151+ if : steps.publish .outputs.type != 'none'
152+ id : changelog
107153108154 env :
109155 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
110156 with :
111157 fromTag : " ${{ env.last_tag }}"
112- toTag : ${{ github.ref }}
158+ toTag : ${{ github.sha }}
113159 commitMode : true
114160 configuration : changelog_config.json
115161
116- - name : Create release for genesys-cloud-chatbot-tester-cli
117- if : steps.publish_cli .outputs.type != 'none'
162+ - name : Create GitHub release
163+ if : steps.publish .outputs.type != 'none'
118164 uses : actions/create-release@v1
119165 env :
120166 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
121167 with :
122- tag_name : genesys-cloud-chatbot-tester-cli-v${{ steps.publish_cli .outputs.version }}
123- release_name : genesys-cloud-chatbot-tester-cli-v${{ steps.publish_cli .outputs.version }}
124- commitish : ${{ github.ref }}
125- body : ${{ steps.changelog_cli .outputs.changelog }}
168+ tag_name : genesys-cloud-chatbot-tester-cli-v${{ steps.publish .outputs.version }}
169+ release_name : genesys-cloud-chatbot-tester-cli-v${{ steps.publish .outputs.version }}
170+ commitish : ${{ github.sha }}
171+ body : ${{ steps.changelog .outputs.changelog }}
126172 draft : false
127173 prerelease : false
0 commit comments