|
1 |
| -# This is a basic workflow to help you get started with Actions |
| 1 | +name: Deploy Tecoble |
2 | 2 |
|
3 |
| -name: build gatsby |
4 |
| - |
5 |
| -# Controls when the action will run. |
6 | 3 | on:
|
7 |
| - # Triggers the workflow on push or pull request events but only for the master branch |
8 | 4 | push:
|
9 |
| - branches: |
| 5 | + branches: |
10 | 6 | - main
|
11 | 7 |
|
12 |
| - # Allows you to run this workflow manually from the Actions tab |
13 |
| - workflow_dispatch: |
14 |
| - |
15 |
| -# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
16 | 8 | jobs:
|
17 |
| - # This workflow contains a single job called "build" |
18 |
| - build_gatsby: |
19 |
| - name: build |
20 |
| - # The type of runner that the job will run on |
| 9 | + deploy: |
| 10 | + name: Deploy Gatsby Project |
21 | 11 | runs-on: ubuntu-latest
|
| 12 | + permissions: |
| 13 | + contents: write |
| 14 | + concurrency: |
| 15 | + group: ${{ github.workflow }} |
| 16 | + cancel-in-progress: true |
22 | 17 |
|
23 |
| - # Steps represent a sequence of tasks that will be executed as part of the job |
24 | 18 | steps:
|
25 |
| - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
26 |
| - - uses: actions/checkout@v3 |
27 |
| - - uses: enriikke/gatsby-gh-pages-action@v2 |
| 19 | + - name: Checkout Repository |
| 20 | + uses: actions/checkout@v3 |
| 21 | + |
| 22 | + - name: Use Node.js |
| 23 | + uses: actions/setup-node@v3 |
| 24 | + with: |
| 25 | + node-version: '20.4' |
| 26 | + cache: npm |
| 27 | + |
| 28 | + - name: Install Dependencies |
| 29 | + run: npm ci |
| 30 | + |
| 31 | + - name: Cache Gatsby `.cache` Folder |
| 32 | + uses: actions/cache@v3 |
| 33 | + id: gatsby-cache-folder |
| 34 | + with: |
| 35 | + path: .cache |
| 36 | + key: ${{ runner.os }}-cache-gatsby |
| 37 | + restore-keys: ${{ runner.os }}-cache-gatsby |
| 38 | + |
| 39 | + - if: steps.gatsby-cache-folder.outputs.cache-hit == 'true' |
| 40 | + run: echo 'gatsby-cache-folder cache hit!' |
| 41 | + |
| 42 | + - name: Cache Gatsby `public` Folder |
| 43 | + uses: actions/cache@v3 |
| 44 | + id: gatsby-public-folder |
| 45 | + with: |
| 46 | + path: public |
| 47 | + key: ${{ runner.os }}-public-gatsby |
| 48 | + restore-keys: ${{ runner.os }}-public-gatsby |
| 49 | + |
| 50 | + - if: steps.gatsby-public-folder.outputs.cache-hit == 'true' |
| 51 | + run: echo 'gatsby-public-folder cache hit!' |
| 52 | + |
| 53 | + - name: Build Gatsby Project |
| 54 | + run: npm run build |
| 55 | + env: |
| 56 | + GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES: true |
| 57 | + |
| 58 | + - name: Deploy to GitHub Pages |
| 59 | + uses: peaceiris/actions-gh-pages@v3 |
28 | 60 | with:
|
29 |
| - access-token: ${{ secrets.FOR_JAVABLE }} |
30 |
| - deploy-branch: gh-pages |
31 |
| - gatsby-args: --prefix-paths |
| 61 | + github_token: ${{ secrets.FOR_JAVABLE }} |
| 62 | + publish_dir: ./public |
0 commit comments