Merge pull request #25 from roc-lang/headerless-app #69
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 and Deploy | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "18" | |
| cache: "npm" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Fetch playground.wasm from latest nightly | |
| run: | | |
| echo "Fetching latest nightly release info..." | |
| LATEST_RELEASE=$(curl -s "https://api.github.com/repos/roc-lang/nightlies/releases/latest") | |
| TAG_NAME=$(echo "$LATEST_RELEASE" | jq -r '.tag_name') | |
| if [ -z "$TAG_NAME" ] || [ "$TAG_NAME" = "null" ]; then | |
| echo "Error: Could not determine latest nightly release tag" | |
| exit 1 | |
| fi | |
| echo "Latest nightly: $TAG_NAME" | |
| DOWNLOAD_URL="https://github.com/roc-lang/nightlies/releases/download/$TAG_NAME/playground.wasm" | |
| echo "Downloading from $DOWNLOAD_URL..." | |
| curl -L --fail -o src/assets/playground.wasm "$DOWNLOAD_URL" | |
| ls -la src/assets/playground.wasm | |
| - name: Security Scan | |
| run: npm audit --audit-level=high | |
| - name: Type check | |
| run: npm run typecheck | |
| - name: Build | |
| run: npm run build | |
| - name: Upload build artifacts | |
| if: github.ref == 'refs/heads/main' | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./dist | |
| deploy: | |
| if: github.ref == 'refs/heads/main' | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |