Bump @hono/node-server from 1.19.13 to 1.19.17 #10195
Workflow file for this run
This file contains hidden or 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: Build & Deploy Cookbook | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| tags: | |
| - 'v[0-9]+.[0-9]+.[0-9]+' | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| defaults: | |
| run: | |
| shell: bash | |
| env: | |
| REPO_URL: https://github.com | |
| REPO_HOST: github.com | |
| jobs: | |
| pre_build: | |
| name: Check if build is needed | |
| runs-on: ubuntu-latest | |
| outputs: | |
| #Build on PRs, PR's merge to default branch, new releases & changes not including 'libs' (which gets build as part of new release) | |
| do_build: ${{ github.event_name == 'pull_request' || github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch' || steps.filter.outputs.libs == 'false' }} | |
| node_version: ${{ steps.get_node_version.outputs.node_version }} | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Check modified files | |
| id: filter | |
| uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1 | |
| with: | |
| filters: | | |
| libs: | |
| - 'libs/**' | |
| - name: Get Node.JS version from package.json | |
| id: get_node_version | |
| run: echo "node_version=$(jq -r .engines.node ./package.json)" >> $GITHUB_OUTPUT | |
| lint_and_unittest: | |
| name: Lint & unit test | |
| needs: pre_build | |
| if: ${{ needs.pre_build.outputs.do_build == 'true' }} | |
| runs-on: ubuntu-latest | |
| env: | |
| NODE_VERSION: ${{ needs.pre_build.outputs.node_version }} | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Kirby setup | |
| uses: ./.github/actions/kirby-setup | |
| - name: Run linting | |
| run: npx nx run-many -t lint && npx stylelint '**/*.scss' | |
| - name: Run node tests | |
| run: npx nx run-many -t test -p tag:test:node --output-style=stream | |
| - name: Run headless-browser tests | |
| run: npx nx run-many -t test -p tag:test:headless-browser --output-style=stream -- --browsers=ChromeCustom --progress false --watch false --code-coverage | |
| build_kirby: | |
| name: Build Kirby lib | |
| needs: pre_build | |
| if: ${{ needs.pre_build.outputs.do_build == 'true' }} | |
| runs-on: ubuntu-latest | |
| env: | |
| NODE_VERSION: ${{ needs.pre_build.outputs.node_version }} | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Kirby setup | |
| uses: ./.github/actions/kirby-setup | |
| - name: Build Kirby lib | |
| run: npx nx build designsystem | |
| build_kirby_cookbook: | |
| name: Build Kirby Cookbook | |
| needs: pre_build | |
| if: ${{ needs.pre_build.outputs.do_build == 'true' }} | |
| runs-on: ubuntu-latest | |
| env: | |
| NODE_VERSION: ${{ needs.pre_build.outputs.node_version }} | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Kirby setup | |
| uses: ./.github/actions/kirby-setup | |
| - name: Build Kirby Cookbook | |
| run: npx nx build cookbook --configuration=production | |
| - name: Upload Kirby Cookbook dist files | |
| uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 | |
| with: | |
| path: | | |
| dist/ | |
| key: cookbook-dist-${{github.run_id}} | |
| deploy_to_cookbook: | |
| name: Deploy cookbook | |
| needs: [build_kirby, build_kirby_cookbook] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # git push to gh-pages branch | |
| deployments: write # create/update GitHub deployments | |
| env: | |
| DOMAIN: 'kirby.design' | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Get deployment name for default or feature branch | |
| if: >- | |
| github.event_name == 'pull_request' || | |
| (github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/v')) || | |
| (github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/develop') | |
| env: | |
| GIT_REF: ${{ github.head_ref || github.ref }} | |
| run: | | |
| releasename=$(bash .github/scripts/normalize-branch-name.sh "$GIT_REF") | |
| branchname="${releasename#kby-}" | |
| echo "GH_DEPLOY_ENVIRONMENT=pr-${branchname}" >> $GITHUB_ENV | |
| echo "RELEASENAME=${releasename}" >> $GITHUB_ENV | |
| echo "IS_RELEASE=false" >> $GITHUB_ENV | |
| - name: Get deployment name for release branch | |
| if: >- | |
| (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) || | |
| (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/develop') | |
| run: | | |
| echo "GH_DEPLOY_ENVIRONMENT=production" >> $GITHUB_ENV | |
| echo "RELEASENAME=designsystem" >> $GITHUB_ENV | |
| echo "IS_RELEASE=true" >> $GITHUB_ENV | |
| - name: Create Github Deployment | |
| id: create_deployment | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| DEPLOY_REF: ${{ github.event_name == 'pull_request' && format('refs/heads/{0}', github.head_ref) || github.ref }} | |
| PRODUCTION_ENV: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/develop' }} | |
| REPO: ${{ github.repository }} | |
| run: | | |
| payload=$(jq -n \ | |
| --arg ref "$DEPLOY_REF" \ | |
| --arg environment "$GH_DEPLOY_ENVIRONMENT" \ | |
| --argjson production_environment $PRODUCTION_ENV \ | |
| '{ref: $ref, environment: $environment, production_environment: $production_environment, auto_merge: false, required_contexts: []}') | |
| deployment_id=$(echo "$payload" | gh api /repos/$REPO/deployments \ | |
| --method POST \ | |
| --input - \ | |
| --jq '.id') | |
| echo "deployment_id=${deployment_id}" >> $GITHUB_OUTPUT | |
| - name: Set deployment status to in progress | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| DEPLOYMENT_STATE: in_progress | |
| REPO: ${{ github.repository }} | |
| DEPLOYMENT_ID: ${{ steps.create_deployment.outputs.deployment_id }} | |
| RUN_ID: ${{ github.run_id }} | |
| run: | | |
| gh api /repos/$REPO/deployments/$DEPLOYMENT_ID/statuses \ | |
| --method POST \ | |
| -f state="$DEPLOYMENT_STATE" \ | |
| -f log_url="$REPO_URL/$REPO/actions/runs/$RUN_ID" | |
| - name: Download Kirby Cookbook dist files | |
| uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 | |
| with: | |
| path: | | |
| dist/ | |
| key: cookbook-dist-${{github.run_id}} | |
| - name: Deploy cookbook to GitHub pages | |
| run: | | |
| set -e | |
| git clone https://x-access-token:$GITHUB_TOKEN@$REPO_HOST/kirbydesign/designsystem.git -b gh-pages designsystem_web | |
| git config --global user.name 'DRB-bot' | |
| git config --global user.email 'dbrr00@bankdata.dk' | |
| mkdir -p designsystem_web/branch | |
| if [ $IS_RELEASE == "true" ]; then | |
| sed -i -E "s,<base href=\"[^\"]*\".*>,<base href=\"/\">,g" dist/apps/cookbook/browser/index.html | |
| find designsystem_web -maxdepth 1 -mindepth 1 ! -name 'branch' ! -name 'CNAME' ! -name '.nojekyll' ! -name '.git' -exec rm -rf {} + | |
| cp -R dist/apps/cookbook/browser/* designsystem_web/ | |
| cp designsystem_web/index.html designsystem_web/404.html | |
| else | |
| # Remove old branch build if exists | |
| rm -rf designsystem_web/branch/$RELEASENAME | |
| mkdir -p designsystem_web/branch/$RELEASENAME | |
| sed -i -E "s,<base href=\"[^\"]*\".*>,<base href=\"/branch/$RELEASENAME/\">,g" dist/apps/cookbook/browser/index.html | |
| cp -R dist/apps/cookbook/browser/* designsystem_web/branch/$RELEASENAME | |
| cp designsystem_web/branch/$RELEASENAME/index.html designsystem_web/branch/$RELEASENAME/404.html | |
| fi | |
| cd designsystem_web | |
| git add . | |
| if ! git diff-index --quiet HEAD; then | |
| git commit -m "Release: $RELEASENAME" | |
| git push | |
| fi | |
| shell: bash | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set deployment status to success | |
| id: successful_deployment | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| DEPLOYMENT_STATE: success | |
| REPO: ${{ github.repository }} | |
| DEPLOYMENT_ID: ${{ steps.create_deployment.outputs.deployment_id }} | |
| RUN_ID: ${{ github.run_id }} | |
| ENVIRONMENT_URL: ${{ env.IS_RELEASE == 'true' && format('https://cookbook.{0}', env.DOMAIN) || format('https://cookbook.{0}/branch/{1}/index.html', env.DOMAIN, env.RELEASENAME) }} | |
| run: | | |
| gh api /repos/$REPO/deployments/$DEPLOYMENT_ID/statuses \ | |
| --method POST \ | |
| -f state="$DEPLOYMENT_STATE" \ | |
| -f log_url="$REPO_URL/$REPO/actions/runs/$RUN_ID" \ | |
| -f environment_url="$ENVIRONMENT_URL" | |
| - name: Set deployment status to failure | |
| id: failed_deployment | |
| if: failure() | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| DEPLOYMENT_STATE: failure | |
| REPO: ${{ github.repository }} | |
| DEPLOYMENT_ID: ${{ steps.create_deployment.outputs.deployment_id }} | |
| RUN_ID: ${{ github.run_id }} | |
| run: | | |
| gh api /repos/$REPO/deployments/$DEPLOYMENT_ID/statuses \ | |
| --method POST \ | |
| -f state="$DEPLOYMENT_STATE" \ | |
| -f log_url="$REPO_URL/$REPO/actions/runs/$RUN_ID" |