Skip to content

Commit

Permalink
Fix samples (second round) (#5300)
Browse files Browse the repository at this point in the history
* Move to npm workspaces

* Add npm version

* Disable pipeline

* Move to workflow_dispatch

* Update upload/download action version

* Bump to actions/checkout@v2

* Move away from set-output

* Update action versions

* Bump actions/checkout@v4

* Fix quote

* Downgrade to v3 because cannot merge artifacts

* Use v4 and merge artifacts

* Use upload-artifact/merge

* No recompress docker.zip

* Set up environment

* Add workflow_dispatch

* Deploy to Pages on all branches

* Redeploy daily

* Deprecate hybrid React version sample

* Fix public path

* Fix upload-pages-artifact

* Merge test results

* Update pull-request-validation.yml

* Fix xargs

* Build only on main

* Remove commented steps

* Run lcov

* On-demand daily release
  • Loading branch information
compulim authored Sep 20, 2024
1 parent e0c6129 commit 0ef9680
Show file tree
Hide file tree
Showing 50 changed files with 7,193 additions and 139,504 deletions.
62 changes: 34 additions & 28 deletions .github/workflows/daily-release.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,35 @@
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

Expand Down Expand Up @@ -60,13 +76,13 @@ 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/**/*
Expand All @@ -76,34 +92,24 @@ jobs:
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.
Expand All @@ -121,7 +127,7 @@ jobs:
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
82 changes: 41 additions & 41 deletions .github/workflows/publish-github-pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,37 @@ on:
paths:
- .github/workflows/publish-github-pages.yaml
- samples/**
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: Run npm ci --no-production
env:
NODE_ENV: production
run: |
cd samples
npm ci --no-production
- name: Use Node.js ${{ env.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.node-version }}
cache: npm

- name: Run npm run bootstrap
run: |
cd samples
npm run bootstrap
- run: npm clean-install
working-directory: ./samples

- name: Run npm run build
env:
NODE_ENV: production
run: |
cd samples
npm run build
run: npm run build
working-directory: ./samples

- name: Copy files
run: |
Expand All @@ -47,11 +51,7 @@ jobs:
rsync -av --progress samples/00.migration/ gh-pages/00.migration/
mkdir gh-pages/01.getting-started
rsync -av --progress samples/01.getting-started/ gh-pages/01.getting-started/ \
--exclude g.hybrid-react-npm
mkdir gh-pages/01.getting-started/g.hybrid-react-npm
rsync -av --progress samples/01.getting-started/g.hybrid-react-npm/packages/app/build/ gh-pages/01.getting-started/g.hybrid-react-npm/
rsync -av --progress samples/01.getting-started/ gh-pages/01.getting-started/
mkdir gh-pages/02.branding-styling-and-customization
rsync -av --progress samples/02.branding-styling-and-customization/ gh-pages/02.branding-styling-and-customization/
Expand All @@ -67,16 +67,16 @@ jobs:
--exclude h.clear-after-idle
mkdir gh-pages/04.api/e.piping-to-redux
rsync -av --progress samples/04.api/e.piping-to-redux/build/ gh-pages/04.api/e.piping-to-redux/
rsync -av --progress samples/04.api/e.piping-to-redux/public/ gh-pages/04.api/e.piping-to-redux/
mkdir gh-pages/04.api/f.selectable-activity
rsync -av --progress samples/04.api/f.selectable-activity/build/ gh-pages/04.api/f.selectable-activity/
rsync -av --progress samples/04.api/f.selectable-activity/public/ gh-pages/04.api/f.selectable-activity/
mkdir gh-pages/04.api/g.chat-send-history
rsync -av --progress samples/04.api/g.chat-send-history/build/ gh-pages/04.api/g.chat-send-history/
rsync -av --progress samples/04.api/g.chat-send-history/public/ gh-pages/04.api/g.chat-send-history/
mkdir gh-pages/04.api/h.clear-after-idle
rsync -av --progress samples/04.api/h.clear-after-idle/build/ gh-pages/04.api/h.clear-after-idle/
rsync -av --progress samples/04.api/h.clear-after-idle/public/ gh-pages/04.api/h.clear-after-idle/
mkdir gh-pages/05.custom-components
rsync -av --progress samples/05.custom-components/ gh-pages/05.custom-components/
Expand All @@ -89,35 +89,35 @@ jobs:
--exclude d.plain-ui
mkdir gh-pages/06.recomposing-ui/a.minimizable-web-chat
rsync -av --progress samples/06.recomposing-ui/a.minimizable-web-chat/build/ gh-pages/06.recomposing-ui/a.minimizable-web-chat/
rsync -av --progress samples/06.recomposing-ui/a.minimizable-web-chat/public/ gh-pages/06.recomposing-ui/a.minimizable-web-chat/
mkdir gh-pages/06.recomposing-ui/b.speech-ui
rsync -av --progress samples/06.recomposing-ui/b.speech-ui/build/ gh-pages/06.recomposing-ui/b.speech-ui/
rsync -av --progress samples/06.recomposing-ui/b.speech-ui/public/ gh-pages/06.recomposing-ui/b.speech-ui/
mkdir gh-pages/06.recomposing-ui/c.smart-display
rsync -av --progress samples/06.recomposing-ui/c.smart-display/build/ gh-pages/06.recomposing-ui/c.smart-display/
rsync -av --progress samples/06.recomposing-ui/c.smart-display/public/ gh-pages/06.recomposing-ui/c.smart-display/
mkdir gh-pages/06.recomposing-ui/d.plain-ui
rsync -av --progress samples/06.recomposing-ui/d.plain-ui/build/ gh-pages/06.recomposing-ui/d.plain-ui/
rsync -av --progress samples/06.recomposing-ui/d.plain-ui/public/ gh-pages/06.recomposing-ui/d.plain-ui/
- name: Upload bundles
uses: actions/upload-artifact@v2
- name: Upload pages artifact
uses: actions/upload-pages-artifact@v3
with:
name: gh-pages
path: gh-pages/**/*
path: gh-pages

release:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

permissions:
id-token: write
pages: write

needs: build
runs-on: ubuntu-latest

steps:
- uses: actions/download-artifact@v2
with:
name: gh-pages
path: ./public

- name: Publish GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
- id: deployment
name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4
Loading

0 comments on commit 0ef9680

Please sign in to comment.