1c9f71754SLoGinname: Documents 2c9f71754SLoGinon: 3*39c9a9f1SLoGin workflow_dispatch: 4c9f71754SLoGin push: 5*39c9a9f1SLoGin branches: [ "main" ] 6c9f71754SLoGin pull_request: 7*39c9a9f1SLoGin branches: [ "main" ] 8c9f71754SLoGin 9c9f71754SLoGinjobs: 10c9f71754SLoGin 11c9f71754SLoGin ensure-toolchain: 12c9f71754SLoGin runs-on: ubuntu-latest 13c9f71754SLoGin steps: 14c9f71754SLoGin - uses: actions/checkout@v3 15c9f71754SLoGin 16c9f71754SLoGin - name: Setup Node.js environment 17c9f71754SLoGin uses: actions/setup-node@v3.7.0 18c9f71754SLoGin with: 19c9f71754SLoGin node-version: "20.11.0" 20c9f71754SLoGin 21c9f71754SLoGin - name: Cache dependencies 22c9f71754SLoGin id: cache-node-modules 23c9f71754SLoGin uses: actions/cache@v3 24c9f71754SLoGin env: 25c9f71754SLoGin cache-name: cache-node-modules 26c9f71754SLoGin with: 27*39c9a9f1SLoGin path: ./docs/node_modules 28c9f71754SLoGin key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package.json') }} 29c9f71754SLoGin 30c9f71754SLoGin - name: echo node version 31c9f71754SLoGin working-directory: ./docs 32c9f71754SLoGin run: node -v 33c9f71754SLoGin 34c9f71754SLoGin - if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }} 35c9f71754SLoGin name: Install dependencies 36c9f71754SLoGin working-directory: ./docs 37c9f71754SLoGin continue-on-error: true 38c9f71754SLoGin run: | 39c9f71754SLoGin sudo apt update && sudo apt install -y build-essential 40c9f71754SLoGin source ~/.bashrc 41c9f71754SLoGin npm install 42c9f71754SLoGin 43c9f71754SLoGin build-and-deploy: 44c9f71754SLoGin permissions: 45c9f71754SLoGin contents: write 46c9f71754SLoGin runs-on: ubuntu-latest 47c9f71754SLoGin needs: [ ensure-toolchain ] 48c9f71754SLoGin steps: 49c9f71754SLoGin - uses: actions/checkout@v3 50c9f71754SLoGin 51c9f71754SLoGin - name: Cache dependencies 52c9f71754SLoGin id: cache-node-modules 53c9f71754SLoGin uses: actions/cache@v3 54c9f71754SLoGin env: 55c9f71754SLoGin cache-name: cache-node-modules 56c9f71754SLoGin with: 57*39c9a9f1SLoGin path: ./docs/node_modules 58c9f71754SLoGin key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package.json') }} 59c9f71754SLoGin 60c9f71754SLoGin - name: Setup Node.js environment 61c9f71754SLoGin uses: actions/setup-node@v3.7.0 62c9f71754SLoGin with: 63c9f71754SLoGin node-version: "20.11.0" 64c9f71754SLoGin 65c9f71754SLoGin - name: Build 66c9f71754SLoGin working-directory: ./docs 67c9f71754SLoGin run: npm run docs:build 68c9f71754SLoGin 69c9f71754SLoGin - name: Deploy 70c9f71754SLoGin working-directory: ./docs 71c9f71754SLoGin env: 72c9f71754SLoGin AWS_ENDPOINT_URL: ${{ secrets.DOCS_DEPLOY_S3_ENDPOINT_URL }} 73c9f71754SLoGin AWS_ACCESS_KEY_ID: ${{ secrets.DOCS_DEPLOY_S3_API_KEY }} 74c9f71754SLoGin AWS_SECRET_ACCESS_KEY: ${{ secrets.DOCS_DEPLOY_S3_SECRET_KEY }} 75*39c9a9f1SLoGin if: github.ref == 'refs/heads/main' && github.repository == 'DragonOS-Community/DADK' 76c9f71754SLoGin run: | 77*39c9a9f1SLoGin sudo apt-get update 78*39c9a9f1SLoGin sudo apt-get install -y python3-pip python3-setuptools 79*39c9a9f1SLoGin python3 -m pip install --user awscli 80c9f71754SLoGin aws s3 sync ./.vuepress/dist s3://dragonos-docs/p/dadk --delete 81