Show full URL for method #350
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: Build | |
on: | |
workflow_call: | |
push: | |
branches: | |
- "**" | |
- "!main" | |
tags-ignore: | |
- "*" | |
env: | |
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} | |
jobs: | |
build: | |
name: Build & Test | |
runs-on: | |
group: ubuntu-large-runners | |
permissions: | |
actions: read | |
contents: read | |
id-token: write | |
env: | |
COREPACK_ENABLE_STRICT: 0 | |
ZUDOKU_INTERNAL_DEV: true | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
run_install: false | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".tool-versions" | |
registry-url: "https://registry.npmjs.org" | |
cache: "pnpm" | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- run: pnpm install nx --global | |
- uses: nrwl/nx-set-shas@v4 | |
- run: nx run-many -t root:lint:ci root:format:ci build:ci | |
- name: Get Variables | |
id: vars | |
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Version (Canary) | |
if: github.event_name == 'push' | |
run: nx release version --specifier 0.0.0-${{ steps.vars.outputs.sha_short }} --git-tag=false | |
- name: Publish Modules | |
run: pnpm publish --provenance --filter zudoku --filter create-zudoku-app --tag canary --no-git-checks | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} | |
- name: Build Examples | |
run: nx run-many -t build --projects=tag:example | |
# Check if the stats file exists, if zudoku doesn't change in the PR | |
# the stats file won't exist and we don't need to upload it | |
- name: Has Stats | |
run: echo "exists=${{ hashFiles('./packages/zudoku/stats.html') != '' }}" >> $GITHUB_OUTPUT | |
id: stats-file | |
- name: "Authenticate to Google Cloud" | |
if: steps.stats-file.outputs.exists == 'true' | |
uses: "google-github-actions/auth@v2" | |
with: | |
token_format: "access_token" | |
workload_identity_provider: ${{ vars.GCP_ACTIONS_IDENTITY_PROVIDER }} | |
service_account: github-actions-opensource@zuplo-production.iam.gserviceaccount.com | |
access_token_lifetime: "300s" | |
- name: Upload Artifacts | |
if: steps.stats-file.outputs.exists == 'true' | |
uses: "google-github-actions/upload-cloud-storage@v2" | |
with: | |
process_gcloudignore: false | |
path: packages/zudoku/stats.html | |
destination: cdn.zudoku.dev/build/rollup/${{ github.run_id }}-${{ github.run_attempt }} | |
parent: false | |
headers: |- | |
content-type: text/html | |
- name: Write Summary | |
if: steps.stats-file.outputs.exists == 'true' | |
run: | | |
echo "📝 Bundle stats uploaded" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "[View Stats](https://cdn.zudoku.dev/build/rollup/${{ github.run_id }}-${{ github.run_attempt }}/stats.html)" >> $GITHUB_STEP_SUMMARY |