Merge pull request #87 from opensourcewin/copilot/fix-build-deploy-job #134
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 to github pages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_run: | |
| workflows: ["Monthly Script Runner"] | |
| types: | |
| - completed | |
| jobs: | |
| build-deploy: | |
| permissions: | |
| contents: write | |
| runs-on: ubuntu-latest | |
| if: "!contains(github.event.head_commit.message, 'skip ci')" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # required so the deploy action can push | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'pnpm' | |
| cache-dependency-path: pnpm-lock.yaml | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build www site | |
| run: pnpm --filter www build | |
| - name: Build ossheroes site | |
| run: pnpm --filter ossheroes build | |
| - name: Merge outputs for GitHub Pages | |
| run: | | |
| rm -rf dist | |
| mkdir -p dist/ossheroes | |
| cp -r apps/www/dist/. dist/ | |
| cp -r apps/ossheroes/dist/ossheroes/. dist/ossheroes/ | |
| # sanity checks | |
| for f in index.html sitemap.xml robots.txt llms.txt; do | |
| if [ ! -f "dist/${f}" ]; then | |
| echo "Error: dist/${f} not found" | |
| exit 1 | |
| fi | |
| done | |
| if [ ! -f dist/ossheroes/index.html ]; then | |
| echo "Error: dist/ossheroes/index.html not found" | |
| exit 1 | |
| fi | |
| - name: Deploy 🚀 | |
| uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| branch: gh-pages | |
| folder: dist |