Merge pull request #170 from ImagingDataCommons/chore/update-to-lates… #63
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: slim/deploy-to-github-pages | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: deploy-gh-pages-${{ github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| deploy-to-github-pages: | |
| # The check name "Deploy to GitHub Pages" is required by the master ruleset, | |
| # so this job must also run (build-only) on pull requests. | |
| name: "Deploy to GitHub Pages" | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0 | |
| with: | |
| node-version: 24 | |
| cache: pnpm | |
| - name: Install dependencies | |
| # Dependency build scripts are gated by allowBuilds in pnpm-workspace.yaml. | |
| # The git-hosted dicom-microscopy-viewer needs its prepare script to build dist/. | |
| run: pnpm install --frozen-lockfile | |
| - name: Require demo DICOMweb URL | |
| env: | |
| SLIM_DEMO_DICOMWEB_URL: ${{ secrets.SLIM_DEMO_DICOMWEB_URL || vars.SLIM_DEMO_DICOMWEB_URL }} | |
| run: | | |
| if [ -z "${SLIM_DEMO_DICOMWEB_URL}" ]; then | |
| echo "::error::Set Actions secret or variable SLIM_DEMO_DICOMWEB_URL (used by public/config/demo.js via window.slim.env)." | |
| exit 1 | |
| fi | |
| - name: Build | |
| env: | |
| SLIM_DEMO_DICOMWEB_URL: ${{ secrets.SLIM_DEMO_DICOMWEB_URL || vars.SLIM_DEMO_DICOMWEB_URL }} | |
| run: pnpm run predeploy | |
| # Only pushes to master (and manual runs) publish; pull requests stop | |
| # after the build so unmerged code never overwrites the live demo site. | |
| - name: Deploy to GitHub Pages | |
| if: github.event_name != 'pull_request' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| git config user.name "github-actions-bot" | |
| git config user.email "support+actions@github.com" | |
| git remote set-url origin "https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" | |
| pnpm exec gh-pages -d build -f |