added build #13
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: Pages | |
| on: | |
| push: | |
| branches: ["main"] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write # Required to push to a branch | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Cache pnpm modules | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.pnpm-store | |
| key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm- | |
| - uses: pnpm/action-setup@v2 | |
| with: | |
| version: latest | |
| - name: Install Dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build | |
| run: | | |
| pnpm run build | |
| ls -la # Debug: List files to see what was created | |
| - name: Prepare for Deployment | |
| run: | | |
| ls -la # Debug: List files again | |
| mkdir -p deployment | |
| cp -r .next/static deployment/ | |
| cp -r dist/* deployment/ || cp -r out/* deployment/ || cp -r build/* deployment/ | |
| - uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./deployment | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Download Build Artifact | |
| uses: actions/download-pages-artifact@v3 | |
| - name: Deploy to `page` Branch | |
| run: | | |
| git config user.name "GitHub Actions" | |
| git config user.email "[email protected]" | |
| git checkout --orphan page | |
| git rm -rf . | |
| cp -r ./deployment/* . | |
| git add . | |
| git commit -m "Deploy to page branch" | |
| git push -f origin page |