Skip to content

Daily release

Daily release #1345

name: Daily release
on:
workflow_dispatch: {}
# push:
# paths:
# - .github/workflows/daily-release.yaml
# schedule:
# - cron: 00 03 * * *
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checking out for ${{ github.ref }}
uses: actions/checkout@v6
# - run: npx version-from-git --no-git-tag-version
- run: npm ci --no-production
- name: Propagate versions
run: node_modules/.bin/lerna version --exact --force-publish --no-git-tag-version --no-push --yes `cat package.json | jq -r .version`
- run: npm run bootstrap
- run: npm run build
env:
NODE_ENV: production
- run: mkdir -p artifacts/tarballs
- name: Run npm pack api
run: |
cd packages/api
npm pack
cp *.tgz ../../artifacts/tarballs
- name: Run npm pack bundle
run: |
cd packages/bundle
npm pack
cp *.tgz ../../artifacts/tarballs
- name: Run npm pack component
run: |
cd packages/component
npm pack
cp *.tgz ../../artifacts/tarballs
- name: Run npm pack core
run: |
cd packages/core
npm pack
cp *.tgz ../../artifacts/tarballs
- name: Run npm pack directlinespeech
run: |
cd packages/directlinespeech
npm pack
cp *.tgz ../../artifacts/tarballs
- name: Run npm pack fluent-theme
run: |
cd packages/fluent-theme
npm pack
cp *.tgz ../../artifacts/tarballs
- name: Upload bundles
uses: actions/upload-artifact@v7
with:
name: bundles
path: packages/bundle/dist/**/*
- name: Upload tarballs
uses: actions/upload-artifact@v7
with:
name: tarballs
path: artifacts/tarballs/**/*
release:
needs: build
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v8
with:
name: bundles
- uses: actions/download-artifact@v8
with:
name: tarballs
- id: compute_hash
name: Compute build metadata
run: |
git_short_sha=$(echo ${{ github.sha }} | cut -c 1-7)
package_version=$(tar -xOzf botframework-webchat-4*.tgz package/package.json | jq -r '.version')
release_date=$(date "+%Y-%m-%d %R:%S")
release_tag_name=v$package_version
sha384_es5=$(cat webchat-es5.js | openssl dgst -sha384 -binary | openssl base64 -A)
sha384_full=$(cat webchat.js | openssl dgst -sha384 -binary | openssl base64 -A)
sha384_minimal=$(cat webchat-minimal.js | openssl dgst -sha384 -binary | openssl base64 -A)
echo git_short_sha=$git_short_sha | tee --append $GITHUB_OUTPUT
echo package_version=$package_version | tee --append $GITHUB_OUTPUT
echo release_date=$release_date | tee --append $GITHUB_OUTPUT
echo release_tag_name=$release_tag_name | tee --append $GITHUB_OUTPUT
echo sha384_es5=$sha384_es5 | tee --append $GITHUB_OUTPUT
echo sha384_full=$sha384_full | tee --append $GITHUB_OUTPUT
echo sha384_minimal=$sha384_minimal | tee --append $GITHUB_OUTPUT
- name: Display build metadata
run: |
echo git_short_sha=${{ steps.compute_hash.outputs.git_short_sha }}
echo package_version=${{ steps.compute_hash.outputs.package_version }}
echo release_date=${{ steps.compute_hash.outputs.release_date }}
echo release_tag_name=${{ steps.compute_hash.outputs.release_tag_name }}
echo sha384_es5=${{ steps.compute_hash.outputs.sha384_es5 }}
echo sha384_full=${{ steps.compute_hash.outputs.sha384_full }}
echo sha384_minimal=${{ steps.compute_hash.outputs.sha384_minimal }}
- name: Delete existing release
# When this workflow is run in its first time, or 2+ are running side-by-side, the release may not exists. It is okay to ignore 404s.
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release delete ${{ steps.compute_hash.outputs.release_tag_name }} --repo ${{ github.repository }} --yes
- name: Create release notes
run: |
cat <<EOF >notes.txt
This release will be updated daily. **Please do not use this build in production environment.**
| Build time | Run ID | Source version | Git ref | Package version |
| - | - | - | - | - |
| ${{ 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 }}` | `${{ steps.compute_hash.outputs.package_version }}` |
```html
<script
crossorigin="anonymous"
integrity="sha384-${{ steps.compute_hash.outputs.sha384_full }}"
src="https://github.com/microsoft/BotFramework-WebChat/releases/download/${{ steps.compute_hash.outputs.release_tag_name }}/webchat.js"
></script>
<script
crossorigin="anonymous"
integrity="sha384-${{ steps.compute_hash.outputs.sha384_es5 }}"
src="https://github.com/microsoft/BotFramework-WebChat/releases/download/${{ steps.compute_hash.outputs.release_tag_name }}/webchat-es5.js"
></script>
<script
crossorigin="anonymous"
integrity="sha384-${{ steps.compute_hash.outputs.sha384_minimal }}"
src="https://github.com/microsoft/BotFramework-WebChat/releases/download/${{ steps.compute_hash.outputs.release_tag_name }}/webchat-minimal.js"
></script>
```
> Note: the SHA384 hash may change daily.
EOF
- name: Create a release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${{ steps.compute_hash.outputs.release_tag_name }} \
--draft \
--notes-file ./notes.txt \
--prerelease \
--repo ${{ github.repository }} \
--title ${{ steps.compute_hash.outputs.release_tag_name }}
- name: Upload assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${{ steps.compute_hash.outputs.release_tag_name }} *.js *.json *.tgz --repo ${{ github.repository }}