|
1 | | -# Sample workflow for building and deploying an Astro site to GitHub Pages |
2 | | -# |
3 | | -# To get started with Astro see: https://docs.astro.build/en/getting-started/ |
4 | | -# |
5 | 1 | name: Deploy Astro site to Pages |
6 | 2 |
|
7 | 3 | on: |
8 | | - # Runs on pushes targeting the default branch |
9 | 4 | push: |
10 | 5 | branches: ["Development"] |
11 | | - |
12 | | - # Allows you to run this workflow manually from the Actions tab |
13 | 6 | workflow_dispatch: |
14 | 7 |
|
15 | | -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
16 | 8 | permissions: |
17 | 9 | contents: read |
18 | 10 | pages: write |
19 | 11 | id-token: write |
20 | 12 |
|
21 | | -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
22 | | -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
23 | 13 | concurrency: |
24 | 14 | group: "pages" |
25 | 15 | cancel-in-progress: false |
26 | 16 |
|
27 | 17 | env: |
28 | | - BUILD_PATH: "." # default value when not using subfolders |
29 | | - # BUILD_PATH: subfolder |
| 18 | + BUILD_PATH: "." |
30 | 19 |
|
31 | 20 | jobs: |
32 | 21 | build: |
33 | 22 | name: Build |
34 | | - runs-on: ubuntu-latest |
| 23 | + runs-on: ubuntu-24.04 |
35 | 24 | steps: |
36 | 25 | - name: Checkout |
37 | 26 | uses: actions/checkout@v4 |
@@ -64,25 +53,32 @@ jobs: |
64 | 53 | id: pages |
65 | 54 | uses: actions/configure-pages@v5 |
66 | 55 | - name: Install dependencies |
67 | | - run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }} |
| 56 | + run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }} --force |
| 57 | + working-directory: ${{ env.BUILD_PATH }} |
| 58 | + - name: Update Astro and dependencies |
| 59 | + run: ${{ steps.detect-package-manager.outputs.manager }} install astro@latest @astrojs/tailwind@latest @astrojs/react@latest @astrojs/rss@latest |
68 | 60 | working-directory: ${{ env.BUILD_PATH }} |
69 | | - - name: Build with Astro |
| 61 | + - name: Build with Astro and copy to public |
70 | 62 | run: | |
71 | 63 | ${{ steps.detect-package-manager.outputs.runner }} astro build \ |
72 | 64 | --site "${{ steps.pages.outputs.origin }}" \ |
73 | | - --base "${{ steps.pages.outputs.base_path }}" |
| 65 | + --base "/" |
| 66 | + rm -rf public/* && cp -r dist/* public/ |
74 | 67 | working-directory: ${{ env.BUILD_PATH }} |
| 68 | + env: |
| 69 | + GH_TOKEN: ${{ secrets.GH_PAT }} |
| 70 | + OPENWEATHER_API_KEY: ${{ secrets.OPENWEATHER_API_KEY }} |
75 | 71 | - name: Upload artifact |
76 | 72 | uses: actions/upload-pages-artifact@v3 |
77 | 73 | with: |
78 | | - path: ${{ env.BUILD_PATH }}/dist |
| 74 | + path: ${{ env.BUILD_PATH }}/public |
79 | 75 |
|
80 | 76 | deploy: |
81 | 77 | environment: |
82 | 78 | name: github-pages |
83 | 79 | url: ${{ steps.deployment.outputs.page_url }} |
84 | 80 | needs: build |
85 | | - runs-on: ubuntu-latest |
| 81 | + runs-on: ubuntu-24.04 |
86 | 82 | name: Deploy |
87 | 83 | steps: |
88 | 84 | - name: Deploy to GitHub Pages |
|
0 commit comments