|
1 | | -name: Build and deploy an updated version of the website |
| 1 | +# Sample workflow for building and deploying a Nuxt site to GitHub Pages |
| 2 | +# |
| 3 | +# To get started with Nuxt see: https://nuxtjs.org/docs/get-started/installation |
| 4 | +# |
| 5 | +name: Build and publish docs to GitHub Pages |
2 | 6 |
|
3 | 7 | on: |
4 | | - push |
| 8 | + # Runs on pushes targeting the default branch |
| 9 | + push: |
| 10 | + branches: [vitepress] |
| 11 | + |
| 12 | + # Allows you to run this workflow manually from the Actions tab |
| 13 | + workflow_dispatch: |
| 14 | + |
| 15 | +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 16 | +permissions: |
| 17 | + contents: read |
| 18 | + pages: write |
| 19 | + id-token: write |
| 20 | + |
| 21 | +# Allow one concurrent deployment |
| 22 | +concurrency: |
| 23 | + group: "pages" |
| 24 | + cancel-in-progress: true |
5 | 25 |
|
6 | 26 | jobs: |
| 27 | + # Build job |
7 | 28 | build: |
8 | 29 | runs-on: ubuntu-latest |
9 | 30 | steps: |
10 | | - - name: Checkout CoderBotOrg/docs |
11 | | - uses: actions/checkout@v2 |
12 | | - with: |
13 | | - repository: CoderBotOrg/docs |
14 | | - path: folder/repo |
15 | | - lfs: true |
| 31 | + - name: Checkout |
| 32 | + uses: actions/checkout@v3 |
| 33 | + - name: Setup Node |
| 34 | + uses: actions/setup-node@v3 |
| 35 | + with: |
| 36 | + node-version: "16" |
| 37 | + cache: ${{ steps.detect-package-manager.outputs.manager }} |
| 38 | + - name: Restore cache |
| 39 | + uses: actions/cache@v3 |
| 40 | + with: |
| 41 | + path: | |
| 42 | + dist |
| 43 | + key: ${{ runner.os }}-build-${{ hashFiles('dist') }} |
| 44 | + restore-keys: | |
| 45 | + ${{ runner.os }}-build- |
| 46 | + - name: Install dependencies |
| 47 | + run: npm ci |
| 48 | + - name: Static HTML export with VitePress |
| 49 | + run: npm run docs:build |
| 50 | + - name: Upload artifact |
| 51 | + uses: actions/upload-pages-artifact@v1 |
| 52 | + with: |
| 53 | + path: ./docs/.vitepress/dist |
16 | 54 |
|
17 | | - - name: Checkout CoderBotOrg/docs |
18 | | - uses: actions/checkout@v2 |
19 | | - with: |
20 | | - repository: CoderBotOrg/docs |
21 | | - ref: master |
22 | | - path: folder/build |
23 | | - lfs: true |
24 | | - |
25 | | - - uses: actions/setup-node@v1 |
26 | | - with: |
27 | | - node-version: '12' |
28 | | - |
29 | | - - name: Install npm dependencies |
30 | | - working-directory: folder/repo/ |
31 | | - run: | |
32 | | - npm install |
33 | | - |
34 | | - - working-directory: folder/ |
35 | | - run: | |
36 | | - cd repo |
37 | | - npm run build |
38 | | - mkdir dist |
39 | | - cp pages/.vuepress/dist/* dist/ -r |
40 | | - cd .. |
41 | | - cp -a repo/dist/. build/ |
42 | | - cd build |
43 | | - mkdir -m 700 ~/.ssh |
44 | | - echo "${{ secrets.SSH_KEY_SECRET }}" > ~/.ssh/id_ed25519 |
45 | | - chmod 0600 ~/.ssh/id_ed25519 |
46 | | - git config --local user.name "GitHub Action" |
47 | | - git config --global user.email "support@coderbot.org" |
48 | | - echo "docs.coderbot.org" > CNAME |
49 | | - git add . |
50 | | - git commit -m "Update build" && git push || : |
| 55 | + # Deployment job |
| 56 | + deploy: |
| 57 | + environment: |
| 58 | + name: github-pages |
| 59 | + url: ${{ steps.deployment.outputs.page_url }} |
| 60 | + runs-on: ubuntu-latest |
| 61 | + needs: build |
| 62 | + steps: |
| 63 | + - name: Deploy to GitHub Pages |
| 64 | + id: deployment |
| 65 | + uses: actions/deploy-pages@v1 |
0 commit comments