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