Shared configs/workflows/prerelease (#180) #94
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: Deploy Apps | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: 'pages' | |
| cancel-in-progress: true | |
| env: | |
| CI: 1 | |
| UPDATE: 1 | |
| jobs: | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check for changes in ./apps | |
| id: changes | |
| shell: bash | |
| run: | | |
| BEFORE_SHA="${{ github.event.before }}" | |
| AFTER_SHA="${{ github.sha }}" | |
| if git cat-file -e "$BEFORE_SHA" 2>/dev/null; then | |
| DIFF_RANGE="$BEFORE_SHA $AFTER_SHA" | |
| else | |
| DIFF_RANGE="HEAD~1 HEAD" | |
| fi | |
| if ! git diff --name-only $DIFF_RANGE | grep '^apps/' ; then | |
| echo "No changes in ./apps directory. Exiting early." | |
| echo "skip_steps=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "skip_steps=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Install pnpm | |
| if: steps.changes.outputs.skip_steps != 'true' | |
| run: npm install -g pnpm | |
| - name: Set up Node (v24) with pnpm cache | |
| if: steps.changes.outputs.skip_steps != 'true' | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| registry-url: 'https://registry.npmjs.org' | |
| cache: 'pnpm' | |
| cache-dependency-path: | | |
| pnpm-lock.yaml | |
| **/pnpm-lock.yaml | |
| - name: Ensure pnpm store exists for caching | |
| if: steps.changes.outputs.skip_steps != 'true' | |
| shell: bash | |
| run: | | |
| STORE="$(pnpm store path)" | |
| echo "pnpm store path: $STORE" | |
| mkdir -p "$STORE" | |
| - name: Install dependencies | |
| if: steps.changes.outputs.skip_steps != 'true' | |
| run: pnpm install --frozen-lockfile | |
| - name: Build apps (with vite-node loader) | |
| if: steps.changes.outputs.skip_steps != 'true' | |
| env: | |
| NODE_OPTIONS: --import=${{ github.workspace }}/plugins/vite-node.plugin.loader.mjs | |
| run: pnpm build apps | |
| - name: Setup Pages | |
| if: steps.changes.outputs.skip_steps != 'true' | |
| uses: actions/configure-pages@v5 | |
| - name: Upload artifact | |
| if: steps.changes.outputs.skip_steps != 'true' | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: './dist' | |
| - name: Deploy to GitHub Pages | |
| if: steps.changes.outputs.skip_steps != 'true' | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |