|
1 |
| -name: Deploy to GitHub Pages |
| 1 | +name: Deploy Astro to GitHub Pages |
2 | 2 |
|
3 | 3 | on:
|
4 |
| - # Trigger the workflow every time you push to the `main` branch |
5 |
| - # Using a different branch name? Replace `main` with your branch’s name |
6 |
| - push: |
7 |
| - branches: [ master ] |
8 |
| - # Allows you to run this workflow manually from the Actions tab on GitHub. |
9 |
| - workflow_dispatch: |
10 | 4 |
|
11 |
| -# Allow this job to clone the repo and create a page deployment |
12 |
| -permissions: |
13 |
| - contents: read |
14 |
| - pages: write |
15 |
| - id-token: write |
| 5 | + |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - master |
| 9 | + - deployment-test-branch |
| 10 | + workflow_dispatch: |
| 11 | + inputs: |
| 12 | + reason: |
| 13 | + description: 'Reason for manual trigger' |
| 14 | + required: false |
| 15 | + default: 'Directus build trigger' |
| 16 | + repository_dispatch: |
| 17 | + types: [build_trigger] |
16 | 18 |
|
17 | 19 | jobs:
|
18 | 20 | build:
|
19 | 21 | runs-on: ubuntu-latest
|
| 22 | + |
20 | 23 | steps:
|
21 |
| - - name: Checkout your repository using git |
22 |
| - uses: actions/checkout@v4 |
23 |
| - - name: Install, build, and upload your site |
24 |
| - uses: withastro/action@v3 |
| 24 | + - name: Checkout repository |
| 25 | + uses: actions/checkout@v2 |
| 26 | + |
| 27 | + - name: Setup Node.js |
| 28 | + uses: actions/setup-node@v2 |
25 | 29 | with:
|
26 |
| - package-manager: npm@latest |
27 |
| - # with: |
28 |
| - # path: . # The root location of your Astro project inside the repository. (optional) |
29 |
| - # node-version: 20 # The specific version of Node that should be used to build your site. Defaults to 20. (optional) |
30 |
| - # package-manager: pnpm@latest # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional) |
31 |
| - |
32 |
| - deploy: |
33 |
| - needs: build |
34 |
| - runs-on: ubuntu-latest |
35 |
| - environment: |
36 |
| - name: github-pages |
37 |
| - url: ${{ steps.deployment.outputs.page_url }} |
38 |
| - steps: |
| 30 | + node-version: '18.x' # Ensure you use a compatible version |
| 31 | + |
| 32 | + - name: Install dependencies |
| 33 | + run: npm install |
| 34 | + |
| 35 | + - name: Build project |
| 36 | + run: npm run build |
| 37 | + |
| 38 | + env: |
| 39 | + DIRECTUS_URL: ${{ secrets.DIRECTUS_URL }} |
| 40 | + |
39 | 41 | - name: Deploy to GitHub Pages
|
40 |
| - id: deployment |
41 |
| - uses: actions/deploy-pages@v4 |
| 42 | + uses: peaceiris/actions-gh-pages@v3 |
| 43 | + with: |
| 44 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 45 | + publish_dir: ./dist |
0 commit comments