Merge branch 'dev' #62
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: Multi-Tier Deployment | |
| on: | |
| push: | |
| branches: ["main", "dev"] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| 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: Detect package manager | |
| id: detect-package-manager | |
| run: | | |
| if [ -f "${{ github.workspace }}/package-lock.json" ]; then | |
| echo "manager=npm" >> $GITHUB_OUTPUT | |
| echo "command=ci" >> $GITHUB_OUTPUT | |
| echo "runner=npx --no-install" >> $GITHUB_OUTPUT | |
| exit 0 | |
| else | |
| echo "Unable to determine package manager" | |
| exit 1 | |
| fi | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: ${{ steps.detect-package-manager.outputs.manager }} | |
| - name: Setup Pages | |
| if: github.ref == 'refs/heads/dev' | |
| uses: actions/configure-pages@v5 | |
| with: | |
| static_site_generator: next | |
| - name: Install dependencies | |
| run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }} | |
| - name: Build with Next.js | |
| run: ${{ steps.detect-package-manager.outputs.runner }} next build | |
| working-directory: ./apps/web | |
| env: | |
| NODE_ENV: production | |
| BASE_PATH: ${{ github.ref == 'refs/heads/dev' && '/RestroFX' || '' }} | |
| NEXT_PUBLIC_BASE_PATH: ${{ github.ref == 'refs/heads/dev' && '/RestroFX' || '' }} | |
| ASSET_PREFIX: ${{ github.ref == 'refs/heads/dev' && '/RestroFX/' || '' }} | |
| - name: Upload GitHub Pages artifact | |
| if: github.ref == 'refs/heads/dev' | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./apps/web/out | |
| - name: Deploy to Hostinger Branch | |
| if: github.ref == 'refs/heads/main' | |
| uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| branch: deploy-prod # The branch Hostinger will pull from | |
| folder: apps/web/out # The folder to upload | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| deploy-github-pages: | |
| if: github.ref == 'refs/heads/dev' | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |