|
@@ -1,82 +1,80 @@
|
|
|
name: Documents
|
|
|
on:
|
|
|
+ workflow_dispatch:
|
|
|
push:
|
|
|
- branches: [ "master"]
|
|
|
+ branches: [ "main" ]
|
|
|
pull_request:
|
|
|
- branches: [ "master" ]
|
|
|
-
|
|
|
+ branches: [ "main" ]
|
|
|
|
|
|
jobs:
|
|
|
|
|
|
ensure-toolchain:
|
|
|
runs-on: ubuntu-latest
|
|
|
steps:
|
|
|
- - uses: actions/checkout@v3
|
|
|
-
|
|
|
- - name: Setup Node.js environment
|
|
|
- working-directory: ./docs
|
|
|
- uses: actions/setup-node@v3.7.0
|
|
|
- with:
|
|
|
- node-version: "20.11.0"
|
|
|
-
|
|
|
- - name: Cache dependencies
|
|
|
- working-directory: ./docs
|
|
|
- id: cache-node-modules
|
|
|
- uses: actions/cache@v3
|
|
|
- env:
|
|
|
- cache-name: cache-node-modules
|
|
|
- with:
|
|
|
- path: ./node_modules
|
|
|
- key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package.json') }}
|
|
|
-
|
|
|
- - name: echo node version
|
|
|
- working-directory: ./docs
|
|
|
- run: node -v
|
|
|
-
|
|
|
- - if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
|
|
|
- name: Install dependencies
|
|
|
- working-directory: ./docs
|
|
|
- continue-on-error: true
|
|
|
- run: |
|
|
|
- sudo apt update && sudo apt install -y build-essential
|
|
|
- source ~/.bashrc
|
|
|
- npm install
|
|
|
-
|
|
|
+ - uses: actions/checkout@v3
|
|
|
+
|
|
|
+ - name: Setup Node.js environment
|
|
|
+ uses: actions/setup-node@v3.7.0
|
|
|
+ with:
|
|
|
+ node-version: "20.11.0"
|
|
|
+
|
|
|
+ - name: Cache dependencies
|
|
|
+ id: cache-node-modules
|
|
|
+ uses: actions/cache@v3
|
|
|
+ env:
|
|
|
+ cache-name: cache-node-modules
|
|
|
+ with:
|
|
|
+ path: ./docs/node_modules
|
|
|
+ key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package.json') }}
|
|
|
+
|
|
|
+ - name: echo node version
|
|
|
+ working-directory: ./docs
|
|
|
+ run: node -v
|
|
|
+
|
|
|
+ - if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
|
|
|
+ name: Install dependencies
|
|
|
+ working-directory: ./docs
|
|
|
+ continue-on-error: true
|
|
|
+ run: |
|
|
|
+ sudo apt update && sudo apt install -y build-essential
|
|
|
+ source ~/.bashrc
|
|
|
+ npm install
|
|
|
+
|
|
|
build-and-deploy:
|
|
|
permissions:
|
|
|
contents: write
|
|
|
runs-on: ubuntu-latest
|
|
|
- needs: [ensure-toolchain]
|
|
|
+ needs: [ ensure-toolchain ]
|
|
|
steps:
|
|
|
- - uses: actions/checkout@v3
|
|
|
+ - uses: actions/checkout@v3
|
|
|
+
|
|
|
+ - name: Cache dependencies
|
|
|
+ id: cache-node-modules
|
|
|
+ uses: actions/cache@v3
|
|
|
+ env:
|
|
|
+ cache-name: cache-node-modules
|
|
|
+ with:
|
|
|
+ path: ./docs/node_modules
|
|
|
+ key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package.json') }}
|
|
|
+
|
|
|
+ - name: Setup Node.js environment
|
|
|
+ uses: actions/setup-node@v3.7.0
|
|
|
+ with:
|
|
|
+ node-version: "20.11.0"
|
|
|
+
|
|
|
+ - name: Build
|
|
|
+ working-directory: ./docs
|
|
|
+ run: npm run docs:build
|
|
|
|
|
|
- - name: Cache dependencies
|
|
|
- working-directory: ./docs
|
|
|
- id: cache-node-modules
|
|
|
- uses: actions/cache@v3
|
|
|
- env:
|
|
|
- cache-name: cache-node-modules
|
|
|
- with:
|
|
|
- path: ./node_modules
|
|
|
- key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package.json') }}
|
|
|
-
|
|
|
- - name: Setup Node.js environment
|
|
|
- working-directory: ./docs
|
|
|
- uses: actions/setup-node@v3.7.0
|
|
|
- with:
|
|
|
- node-version: "20.11.0"
|
|
|
-
|
|
|
- - name: Build
|
|
|
- working-directory: ./docs
|
|
|
- run: npm run docs:build
|
|
|
-
|
|
|
-
|
|
|
- - name: Deploy
|
|
|
- working-directory: ./docs
|
|
|
- env:
|
|
|
- AWS_ENDPOINT_URL: ${{ secrets.DOCS_DEPLOY_S3_ENDPOINT_URL }}
|
|
|
- AWS_ACCESS_KEY_ID: ${{ secrets.DOCS_DEPLOY_S3_API_KEY }}
|
|
|
- AWS_SECRET_ACCESS_KEY: ${{ secrets.DOCS_DEPLOY_S3_SECRET_KEY }}
|
|
|
- if: github.ref == 'refs/heads/master' && github.repository == 'DragonOS-Community/DADK'
|
|
|
- run: |
|
|
|
- aws s3 sync ./.vuepress/dist s3://dragonos-docs/p/dadk --delete
|
|
|
+ - name: Deploy
|
|
|
+ working-directory: ./docs
|
|
|
+ env:
|
|
|
+ AWS_ENDPOINT_URL: ${{ secrets.DOCS_DEPLOY_S3_ENDPOINT_URL }}
|
|
|
+ AWS_ACCESS_KEY_ID: ${{ secrets.DOCS_DEPLOY_S3_API_KEY }}
|
|
|
+ AWS_SECRET_ACCESS_KEY: ${{ secrets.DOCS_DEPLOY_S3_SECRET_KEY }}
|
|
|
+ if: github.ref == 'refs/heads/main' && github.repository == 'DragonOS-Community/DADK'
|
|
|
+ run: |
|
|
|
+ sudo apt-get update
|
|
|
+ sudo apt-get install -y python3-pip python3-setuptools
|
|
|
+ python3 -m pip install --user awscli
|
|
|
+ aws s3 sync ./.vuepress/dist s3://dragonos-docs/p/dadk --delete
|