releases #74
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'releases' | |
on: | |
workflow_dispatch: | |
inputs: | |
build_dashboard: | |
description: 'deploy dashboard & storybook' | |
required: false | |
type: boolean | |
default: false | |
deploy_storybook: | |
description: 'deploy storybook' | |
required: false | |
type: boolean | |
default: false | |
build_python_handshakes: | |
description: 'deploy handshake py-build' | |
required: false | |
type: boolean | |
default: false | |
release_nodejs_based_reporters: | |
description: 'deploy custom-reporters-node' | |
required: false | |
type: boolean | |
default: false | |
permissions: | |
contents: write | |
jobs: | |
release-dashboard: | |
name: Builds and Release Dashboard Static Build | |
runs-on: 'ubuntu-latest' | |
permissions: write-all | |
if: ${{ inputs.build_dashboard }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
version: 8 | |
run_install: false | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.9.0 | |
cache: 'pnpm' | |
cache-dependency-path: handshake-nodejs-reporters/pnpm-lock.yaml | |
- name: Installing node packages | |
working-directory: ./handshake-nodejs-reporters/packages/handshake-dashboard | |
run: pnpm install | |
- name: Building Dashboard | |
working-directory: ./handshake-nodejs-reporters/packages/handshake-dashboard | |
run: pnpm build | |
- name: Zipping the dashboard export | |
working-directory: dashboard | |
run: tar -cjf ../dashboard.tar.bz2 * | |
- name: fetch dashboard-version | |
id: version | |
run: bash .github/scripts/fetch-dashboard-version.sh | |
- name: create release | |
uses: softprops/action-gh-release@v2 | |
id: release | |
with: | |
files: dashboard.tar.bz2 | |
body: ":rocket: Bump Handshake-server version to `${{ steps.version.outputs.VERSION }}`" | |
tag_name: ${{ steps.version.outputs.VERSION }} | |
name: "Handshake v${{ steps.version.outputs.VERSION }}" | |
generate_release_notes: true | |
- name: build version file | |
env: | |
ASSETS: ${{ steps.release.outputs.assets }} | |
run: node .github/scripts/sdv.cjs | |
- name: commiting the changes | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
id: post-release | |
with: | |
commit_message: Bump dashboard version in common-handshake's .version file | |
file_pattern: '**/.version' | |
release-handshakes: | |
needs: release-dashboard | |
name: releases handshakes to pypi | |
runs-on: 'ubuntu-latest' | |
permissions: write-all | |
# if dashboard-build has not failed (if triggered) then only run this job (if triggered) | |
if: ${{ !failure() && inputs.build_python_handshakes }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Set up venv | |
run: | | |
python -m venv venv | |
- name: Activate venv | |
run: | | |
source ./venv/bin/activate | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry nox | |
- name: Build Package | |
run: poetry build | |
- name: Publish handshakes to PYPI | |
env: | |
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
run: | | |
poetry config pypi-token.pypi $PYPI_TOKEN | |
poetry publish | |
- name: Post Release, Update common-handshakes | |
run: nox -s save_version | |
- name: commiting the changes | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
id: post-release | |
with: | |
commit_message: Bump handshakes version in common-handshake's .version file | |
file_pattern: '**/.version' | |
release-common-handshake-reporters: | |
needs: [ release-dashboard, release-handshakes ] | |
name: releases common handshake node reporters to npm | |
runs-on: 'ubuntu-latest' | |
permissions: write-all | |
# if (dashboard-build and py-build) has not failed (if triggered) then only run this job (if needed) | |
if: ${{ !failure() && inputs.release_nodejs_based_reporters }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
version: 8 | |
run_install: false | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.9.0 | |
cache: 'pnpm' | |
cache-dependency-path: handshake-nodejs-reporters/pnpm-lock.yaml | |
- name: Setup Turbo Repo. | |
working-directory: ./handshake-nodejs-reporters | |
run: | |
pnpm install | |
- name: skip job if no changesets | |
working-directory: ./handshake-nodejs-reporters | |
run: npx changeset status | |
- name: Create .npmrc file | |
working-directory: ./handshake-nodejs-reporters | |
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc | |
- name: publish packages | |
working-directory: ./handshake-nodejs-reporters | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: pnpm publish-packages | |
- name: commiting the changes | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
id: post-release | |
with: | |
commit_message: Bump Handshake Dashboard Version | |
file_pattern: 'handshake-nodejs-reporters/**/*.md handshake-nodejs-reporters/**/*.json' | |
host-storybook: | |
needs: [ release-dashboard, release-handshakes, release-common-handshake-reporters ] | |
name: deploy-storybook | |
runs-on: 'ubuntu-latest' | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
if: ${{ !failure() && (inputs.deploy_storybook || inputs.build_dashboard) }} | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
version: 8 | |
run_install: false | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.9.0 | |
- name: Installing node packages | |
working-directory: ./handshake-nodejs-reporters/packages/handshake-dashboard | |
run: pnpm install | |
- name: Building storybook | |
working-directory: ./handshake-nodejs-reporters/packages/handshake-dashboard | |
run: pnpm build-storybook --quiet | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./handshake-nodejs-reporters/packages/handshake-dashboard/storybook-static | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |