|
1 | | -# Simple workflow for deploying static content to GitHub Pages |
2 | | -name: Deploy static content to Pages |
| 1 | +name: Deploy |
3 | 2 |
|
4 | 3 | on: |
5 | | - # Runs on pushes targeting the default branch |
6 | 4 | push: |
7 | | - branches: ['main'] |
8 | | - |
9 | | - # Allows you to run this workflow manually from the Actions tab |
10 | | - workflow_dispatch: |
11 | | - |
12 | | -# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages |
13 | | -permissions: |
14 | | - contents: read |
15 | | - pages: write |
16 | | - id-token: write |
17 | | - |
18 | | -# Allow one concurrent deployment |
19 | | -concurrency: |
20 | | - group: 'pages' |
21 | | - cancel-in-progress: true |
| 5 | + branches: |
| 6 | + - main |
22 | 7 |
|
23 | 8 | jobs: |
24 | | - # Single deploy job since we're just deploying |
25 | | - deploy: |
26 | | - environment: |
27 | | - name: github-pages |
28 | | - url: ${{ steps.deployment.outputs.page_url }} |
| 9 | + build: |
| 10 | + name: Build |
29 | 11 | runs-on: ubuntu-latest |
| 12 | + |
30 | 13 | steps: |
31 | | - - name: Checkout |
32 | | - uses: actions/checkout@v4 |
33 | | - - name: Set up Node |
34 | | - uses: actions/setup-node@v4 |
| 14 | + - name: Checkout repo |
| 15 | + uses: actions/checkout@v3 |
| 16 | + |
| 17 | + - name: Setup Node |
| 18 | + uses: actions/setup-node@v3 |
| 19 | + |
35 | 20 | - name: Install dependencies |
36 | 21 | uses: bahmutov/npm-install@v1 |
37 | | - - name: Build |
| 22 | + |
| 23 | + - name: Build project |
38 | 24 | run: npm run build |
39 | | - - name: Setup Pages |
40 | | - uses: actions/configure-pages@v4 |
41 | | - - name: Upload artifact |
42 | | - uses: actions/upload-pages-artifact@v3 |
| 25 | + |
| 26 | + - name: Upload production-ready build files |
| 27 | + uses: actions/upload-artifact@v3 |
43 | 28 | with: |
44 | | - # Upload dist folder |
45 | | - path: './dist' |
| 29 | + name: production-files |
| 30 | + path: ./dist |
| 31 | + |
| 32 | + deploy: |
| 33 | + name: Deploy |
| 34 | + needs: build |
| 35 | + runs-on: ubuntu-latest |
| 36 | + if: github.ref == 'refs/heads/main' |
| 37 | + |
| 38 | + steps: |
| 39 | + - name: Download artifact |
| 40 | + uses: actions/download-artifact@v3 |
| 41 | + with: |
| 42 | + name: production-files |
| 43 | + path: ./dist |
| 44 | + |
46 | 45 | - name: Deploy to GitHub Pages |
47 | | - id: deployment |
48 | | - uses: actions/deploy-pages@v4 |
| 46 | + uses: peaceiris/actions-gh-pages@v3 |
| 47 | + with: |
| 48 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 49 | + publish_dir: ./dist |
0 commit comments