Skip to content

Commit

Permalink
Update daily-release.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
compulim authored Sep 24, 2024
1 parent a03e74d commit 9949161
Showing 1 changed file with 47 additions and 39 deletions.
86 changes: 47 additions & 39 deletions .github/workflows/daily-release.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,46 @@
name: Daily release

# For internal on-demand tests, until we can build it in AzDO.

on:
push:
paths:
- .github/workflows/daily-release.yaml
schedule:
- cron: 00 03 * * *
# push:
# paths:
# - .github/workflows/daily-release.yaml
# schedule:
# - cron: 00 03 * * *
workflow_dispatch: {}

defaults:
run:
shell: bash

env:
node-version: 22

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checking out for ${{ github.ref }}
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Use Node.js ${{ env.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.node-version }}
cache: npm

- run: npx version-from-git --no-git-tag-version

- run: npm ci --no-production
- run: npm clean-install --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 version --no-git-tag-version --no-workspaces-update --workspaces `cat package.json | jq -r .version`

- run: npm run bootstrap
- run: npm run build
env:
- env:
NODE_ENV: production
run: npm run build

- run: mkdir -p artifacts/tarballs

Expand Down Expand Up @@ -60,68 +75,61 @@ jobs:
cp *.tgz ../../artifacts/tarballs
- name: Upload bundles
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: bundles
path: packages/bundle/dist/**/*

- name: Upload tarballs
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: tarballs
path: artifacts/tarballs/**/*

release:
needs: build
permissions:
contents: write
packages: write
runs-on: ubuntu-latest

steps:
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
with:
name: bundles

- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
with:
name: tarballs

- id: compute_hash
name: Compute build metadata
run: |
echo "::set-output name=git_short_sha::`echo ${{ github.sha }} | cut -c 1-7`"
echo "::set-output name=package_version::`tar -xOzf botframework-webchat-4*.tgz package/package.json | jq -r '.version'`"
echo "::set-output name=release_date::`date \"+%Y-%m-%d %R:%S\"`"
echo "::set-output name=release_tag_name::daily"
echo "::set-output name=sha384_es5::`cat webchat-es5.js | openssl dgst -sha384 -binary | openssl base64 -A`"
echo "::set-output name=sha384_full::`cat webchat.js | openssl dgst -sha384 -binary | openssl base64 -A`"
echo "::set-output name=sha384_minimal::`cat webchat-minimal.js | openssl dgst -sha384 -binary | openssl base64 -A`"
- 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 }}
echo git_short_sha=`echo ${{ github.sha }} | cut -c 1-7` | tee --append $GITHUB_OUTPUT
echo package_version=`tar -xOzf botframework-webchat-4*.tgz package/package.json | jq -r '.version'` | tee --append $GITHUB_OUTPUT
echo release_date=`date "+%Y-%m-%d %R:%S"` | tee --append $GITHUB_OUTPUT
echo release_tag_name=daily | tee --append $GITHUB_OUTPUT
echo sha384_es5=`cat webchat-es5.js | openssl dgst -sha384 -binary | openssl base64 -A` | tee --append $GITHUB_OUTPUT
echo sha384_full=`cat webchat.js | openssl dgst -sha384 -binary | openssl base64 -A` | tee --append $GITHUB_OUTPUT
echo sha384_minimal=`cat webchat-minimal.js | openssl dgst -sha384 -binary | openssl base64 -A` | tee --append $GITHUB_OUTPUT
- 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 }}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release delete ${{ steps.compute_hash.outputs.release_tag_name }} --repo ${{ github.repository }} --yes

- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.compute_hash.outputs.release_tag_name }}
release_name: Daily (${{ github.ref }})
body: |
This release will be updated daily. **Please do not use this build in production environment.**
This release is for internal testing only. **Please do not use this build in production environment.**
| Build time | Run ID | Source version | Git ref | Package version |
| - | - | - | - | - |
Expand Down Expand Up @@ -152,6 +160,6 @@ jobs:
prerelease: true

- name: Upload assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${{ steps.compute_hash.outputs.release_tag_name }} *.js *.json *.tgz --repo ${{ github.repository }}

0 comments on commit 9949161

Please sign in to comment.