@@ -18,117 +18,201 @@ env:
1818 node-version : 22
1919
2020jobs :
21- prepare :
22- name : Prepare
21+ # prepare:
22+ # name: Prepare
23+ # outputs:
24+ # branch-name: ${{ steps.get-branch-name.outputs.branch-name }}
25+ # permissions:
26+ # contents: read
27+ # runs-on: ubuntu-latest
28+
29+ # steps:
30+ # - uses: actions/checkout@v6
31+
32+ # - id: get-branch-name
33+ # name: Get branch name
34+ # run: |
35+ # BRANCH_NAME=$(git symbolic-ref --short HEAD 2>/dev/null || git rev-parse --short HEAD)
36+
37+ # echo branch-name=$BRANCH_NAME | tee --append $GITHUB_OUTPUT
38+
39+ # # - uses: actions/setup-node@v6
40+ # # with:
41+ # # node-version: ${{ env.node-version }}
42+
43+ # # - id: version-type
44+ # # name: Determine version type
45+ # # run: 'if [[ "$(cat ./package.json | jq -r ''.version'')" == *-0 ]]; then echo version-type=prerelease | tee --append $GITHUB_OUTPUT; else echo version-type=production | tee --append $GITHUB_OUTPUT; fi'
46+
47+ # # - if: steps.version-type.outputs.version-type != 'production'
48+ # # name: Set version
49+ # # run: |
50+ # # BRANCH_NAME=$(git symbolic-ref --short HEAD 2>/dev/null || git rev-parse --short HEAD)
51+ # # COMMITISH=${{ github.sha }}
52+ # # NOW=$(date +%Y%m%d%H%M)
53+
54+ # # SHORT_COMMITISH=${COMMITISH:0:7}
55+
56+ # # # npm version simply ignoring the build metadata + (plus) sign, we need to use dot or hyphen instead.
57+ # # npm version --no-git-tag-version $(echo $(cat ./package.json | jq -r '.version') | cut -d- -f1)-$BRANCH_NAME.$NOW.$SHORT_COMMITISH
58+
59+ # # - id: version
60+ # # name: Get version
61+ # # run: echo version=$(cat package.json | jq -r '.version') | tee --append $GITHUB_OUTPUT
62+
63+ # build:
64+ # name: Build
65+ # permissions:
66+ # contents: read
67+ # needs: prepare
68+ # runs-on: ubuntu-latest
69+
70+ # steps:
71+ # - uses: actions/checkout@v6
72+
73+ # - uses: actions/setup-node@v6
74+ # with:
75+ # node-version: ${{ env.node-version }}
76+
77+ # - run: npm clean-install
78+
79+ # - name: npm version ${{ needs.prepare.outputs.version }}
80+ # run: |
81+ # npm version ${{ needs.prepare.outputs.version }} \
82+ # --include-workspace-root \
83+ # --no-git-tag-version \
84+ # --no-workspaces-update \
85+ # --workspaces
86+
87+ # - env:
88+ # NODE_ENV: production
89+ # run: npm run build
90+
91+ # - name: Pack as tarball
92+ # run: |
93+ # npm pack \
94+ # --workspace=./packages/core \
95+ # --workspace=./packages/api \
96+ # --workspace=./packages/component \
97+ # --workspace=./packages/bundle \
98+ # --workspace=./packages/fluent-theme
99+
100+ # # - name: Generate SBOM
101+ # # # --workspace has no effect, the resulting SBOM still contains other packages in the workspace
102+ # # run: npm sbom --package-lock-only --sbom-format spdx --sbom-type library | tee ./sbom.spdx.json
103+
104+ # - uses: actions/upload-artifact@v7
105+ # with:
106+ # name: tarball
107+ # path: ./*.tgz
108+
109+ # - uses: actions/upload-artifact@v7
110+ # with:
111+ # name: bundle-iife
112+ # path: ./packages/bundle/dist/webchat*.js
113+
114+ # - uses: actions/upload-artifact@v7
115+ # with:
116+ # name: bundle-esm
117+ # path: ./packages/bundle/static/**/*
118+
119+ # - uses: actions/upload-artifact@v7
120+ # with:
121+ # name: fluent-theme-iife
122+ # path: ./packages/fluent-theme/dist/**/*
123+
124+ # - uses: actions/upload-artifact@v7
125+ # with:
126+ # name: fluent-theme-esm
127+ # path: ./packages/fluent-theme/static/**/*
128+
129+ # # - name: Upload SBOM artifact
130+ # # uses: actions/upload-artifact@v7
131+ # # with:
132+ # # name: sbom
133+ # # path: ./sbom.spdx.json
134+
135+ build :
136+ name : Build
23137 outputs :
24- version : ${{ steps.version.outputs.version }}
25- version-type : ${{ steps.version-type.outputs.version-type }}
26- permissions :
27- contents : read
28- runs-on : ubuntu-latest
138+ version : ${{ steps.azdo-build.outputs.version }}
139+ version-type : ${{ steps.azdo-build.outputs.version-type }}
140+ permissions : {}
141+ runs-on : ubuntu-slim
29142
30143 steps :
31144 - uses : actions/checkout@v6
32145
33- - uses : actions/setup-node@v6
34- with :
35- node-version : ${{ env.node-version }}
36-
37- - id : version-type
38- name : Determine version type
39- run : ' if [[ "$(cat ./package.json | jq -r '' .version'' )" == *-0 ]]; then echo version-type=prerelease | tee --append $GITHUB_OUTPUT; else echo version-type=production | tee --append $GITHUB_OUTPUT; fi'
40-
41- - if : steps.version-type.outputs.version-type != 'production'
42- name : Set version
146+ - id : get-branch-name
147+ name : Get branch name
43148 run : |
44149 BRANCH_NAME=$(git symbolic-ref --short HEAD 2>/dev/null || git rev-parse --short HEAD)
45- COMMITISH=${{ github.sha }}
46- NOW=$(date +%Y%m%d%H%M)
47-
48- SHORT_COMMITISH=${COMMITISH:0:7}
49-
50- # npm version simply ignoring the build metadata + (plus) sign, we need to use dot or hyphen instead.
51- npm version --no-git-tag-version $(echo $(cat ./package.json | jq -r '.version') | cut -d- -f1)-$BRANCH_NAME.$NOW.$SHORT_COMMITISH
52-
53- - id : version
54- name : Get version
55- run : echo version=$(cat package.json | jq -r '.version') | tee --append $GITHUB_OUTPUT
56-
57- build :
58- name : Build
59- permissions :
60- contents : read
61- needs : prepare
62- runs-on : ubuntu-latest
63150
64- steps :
65- - uses : actions/checkout@v6
151+ echo branch-name=$BRANCH_NAME | tee --append $GITHUB_OUTPUT
66152
67- - uses : actions/setup-node@v6
153+ - id : azdo-build
154+ uses : ./.github/workflows/reusable-azdo-build.yml
68155 with :
69- node-version : ${{ env.node-version }}
70-
71- - run : npm clean-install
156+ artifact-name : azdo-artifact
157+ branch-name : ${{ steps.get-branch-name.outputs.branch-name }}
72158
73- - name : npm version ${{ needs.prepare.outputs.version }}
159+ - name : Extract artifact (bundle)
74160 run : |
75- npm version ${{ needs.prepare.outputs.version }} \
76- --include-workspace-root \
77- --no-git-tag-version \
78- --no-workspaces-update \
79- --workspaces
161+ mkdir -p ./bundle/
162+ cd ./bundle/
80163
81- - env :
82- NODE_ENV : production
83- run : npm run build
164+ tar \
165+ --extract \
166+ --file=botframework-webchat-${{ steps.azdo-build.outputs.version }}.tgz \
167+ --strip-component=1 \
168+ package/dist/ \
169+ package/static/
84170
85- - name : Pack as tarball
171+ - name : Extract artifact (fluent-theme)
86172 run : |
87- npm pack \
88- --workspace=./packages/core \
89- --workspace=./packages/api \
90- --workspace=./packages/component \
91- --workspace=./packages/bundle \
92- --workspace=./packages/ fluent-theme
93-
94- # - name: Generate SBOM
95- # # --workspace has no effect, the resulting SBOM still contains other packages in the workspace
96- # run: npm sbom --package-lock-only --sbom-format spdx --sbom-type library | tee ./sbom.spdx.json
97-
98- - uses : actions/upload-artifact@v7
173+ mkdir -p ./fluent-theme/
174+ cd ./fluent-theme/
175+
176+ tar \
177+ --extract \
178+ --file=botframework-webchat- fluent-theme-${{ steps.azdo-build.outputs.version }}.tgz \
179+ --strip-component=1 \
180+ package/dist/ \
181+ package/static/
182+
183+ - name : Upload artifact (tarball)
184+ uses : actions/upload-artifact@v7
99185 with :
100186 name : tarball
101- path : ./*.tgz
187+ path : ./tgzfiles/ *.tgz
102188
103- - uses : actions/upload-artifact@v7
189+ - name : Upload artifact (bundle-iife)
190+ uses : actions/upload-artifact@v7
104191 with :
105192 name : bundle-iife
106- path : ./packages/ bundle/dist/webchat*.js
193+ path : ./bundle/dist/webchat*.js
107194
108- - uses : actions/upload-artifact@v7
195+ - name : Upload artifact (bundle-esm)
196+ uses : actions/upload-artifact@v7
109197 with :
110198 name : bundle-esm
111- path : ./packages/ bundle/static/**/*
199+ path : ./bundle/static/
112200
113- - uses : actions/upload-artifact@v7
201+ - name : Upload artifact (fluent-theme-iife)
202+ uses : actions/upload-artifact@v7
114203 with :
115204 name : fluent-theme-iife
116- path : ./packages/ fluent-theme/dist/**/*
205+ path : ./fluent-theme/dist/webchat*.js
117206
118- - uses : actions/upload-artifact@v7
207+ - name : Upload artifact (fluent-theme-esm)
208+ uses : actions/upload-artifact@v7
119209 with :
120210 name : fluent-theme-esm
121- path : ./packages/fluent-theme/static/**/*
122-
123- # - name: Upload SBOM artifact
124- # uses: actions/upload-artifact@v7
125- # with:
126- # name: sbom
127- # path: ./sbom.spdx.json
211+ path : ./fluent-theme/static/
128212
129213 upload-changelog :
130214 name : Upload changelog
131- needs : prepare
215+ needs : build
132216 permissions :
133217 contents : read
134218 runs-on : ubuntu-latest
@@ -142,9 +226,9 @@ jobs:
142226
143227 - run : npm install --global keep-a-changelog@2 prettier
144228
145- - if : needs.prepare .outputs.version-type != 'production'
229+ - if : needs.build .outputs.version-type != 'production'
146230 name : Tag unreleased as latest
147- run : npx keep-a-changelog --format markdownlint --release=${{ needs.prepare .outputs.version }}
231+ run : npx keep-a-changelog --format markdownlint --release=${{ needs.build .outputs.version }}
148232
149233 - name : Extract latest entry
150234 run : npx keep-a-changelog --format markdownlint --latest-release-full | tee ./CHANGELOG.latest.md
@@ -162,7 +246,6 @@ jobs:
162246 name : Release
163247 needs :
164248 - build
165- - prepare
166249 - upload-changelog
167250 permissions :
168251 contents : write
@@ -209,25 +292,25 @@ jobs:
209292
210293 | Build time | Run ID | Source version | Git ref | Package version |
211294 | - | - | - | - | - |
212- | ${{ steps.compute-hash.outputs.release-date }}Z | [\`${{ github.run_id }}\`](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) | [\`${{ steps.compute-hash.outputs.git-short-sha }}\`](https://github.com/${{ github.repository }}/commit/${{ github.sha }}) | \`${{ github.ref }}\` | \`${{ needs.prepare .outputs.version }}\` |
295+ | ${{ steps.compute-hash.outputs.release-date }}Z | [\`${{ github.run_id }}\`](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) | [\`${{ steps.compute-hash.outputs.git-short-sha }}\`](https://github.com/${{ github.repository }}/commit/${{ github.sha }}) | \`${{ github.ref }}\` | \`${{ needs.build .outputs.version }}\` |
213296
214297 \`\`\`html
215298 <script
216299 crossorigin="anonymous"
217300 integrity="sha384-${{ steps.compute-hash.outputs.sha384-full }}"
218- src="https://cdn.botframework.com/botframework-webchat@${{ needs.prepare .outputs.version }}/dist/webchat.js"
301+ src="https://cdn.botframework.com/botframework-webchat@${{ needs.build .outputs.version }}/dist/webchat.js"
219302 ></script>
220303
221304 <script
222305 crossorigin="anonymous"
223306 integrity="sha384-${{ steps.compute-hash.outputs.sha384-es5 }}"
224- src="https://cdn.botframework.com/botframework-webchat@${{ needs.prepare .outputs.version }}/dist/webchat-es5.js"
307+ src="https://cdn.botframework.com/botframework-webchat@${{ needs.build .outputs.version }}/dist/webchat-es5.js"
225308 ></script>
226309
227310 <script
228311 crossorigin="anonymous"
229312 integrity="sha384-${{ steps.compute-hash.outputs.sha384-minimal }}"
230- src="https://cdn.botframework.com/botframework-webchat@${{ needs.prepare .outputs.version }}/dist/webchat-minimal.js"
313+ src="https://cdn.botframework.com/botframework-webchat@${{ needs.build .outputs.version }}/dist/webchat-minimal.js"
231314 ></script>
232315 \`\`\`
233316
@@ -244,9 +327,9 @@ jobs:
244327 name : Create release
245328 # Do not upload assets while creating release, otherwise, it will not trigger "release created" event.
246329 run : |
247- if [[ "${{ needs.prepare .outputs.version-type }}" == "prerelease" ]]; then PRERELEASE=1; fi
330+ if [[ "${{ needs.build .outputs.version-type }}" == "prerelease" ]]; then PRERELEASE=1; fi
248331
249- TAG=v${{ needs.prepare .outputs.version }}
332+ TAG=v${{ needs.build .outputs.version }}
250333
251334 gh release create $TAG \
252335 --notes-file ./release.txt \
0 commit comments