Add docs.yaml, update test.yaml, vuepress
This commit is contained in:
79
.github/workflows/docs.yaml
vendored
Normal file
79
.github/workflows/docs.yaml
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
name: Deploy Documentation
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["Test"]
|
||||
types:
|
||||
- completed
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
jobs:
|
||||
build-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '16'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
working-directory: './docs'
|
||||
|
||||
- name: Download coverage artifacts
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
run_id: ${{github.event.workflow_run.id }},
|
||||
});
|
||||
var matchArtifacts = artifacts.data.artifacts.filter((artifact) => {
|
||||
return artifact.name.startsWith("Coverage results for")
|
||||
});
|
||||
for (const artifact of matchArtifacts) {
|
||||
var download = await github.rest.actions.downloadArtifact({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
artifact_id: artifact.id,
|
||||
archive_format: 'zip',
|
||||
});
|
||||
var fs = require('fs');
|
||||
fs.writeFileSync(`${{github.workspace}}/${artifact.name}.zip`, Buffer.from(download.data));
|
||||
}
|
||||
|
||||
- name: Extract coverage reports
|
||||
run: |
|
||||
mkdir -p ./docs/.vuepress/public/coverage
|
||||
for file in Coverage*.zip; do
|
||||
mode=$(echo $file | sed 's/Coverage results for \(.*\)\.zip/\1/')
|
||||
unzip -o "$file" -d "./docs/.vuepress/public/coverage/$mode"
|
||||
done
|
||||
|
||||
- name: Build documentation
|
||||
run: npm run docs:build
|
||||
working-directory: './docs'
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v2
|
||||
with:
|
||||
path: 'docs/.vuepress/dist'
|
||||
|
||||
deploy:
|
||||
needs: build-deploy
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: github-pages
|
||||
steps:
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v2
|
||||
25
.github/workflows/test.yaml
vendored
25
.github/workflows/test.yaml
vendored
@@ -50,27 +50,4 @@ jobs:
|
||||
if: always()
|
||||
with:
|
||||
name: Coverage results for ${{ matrix.testMode }}
|
||||
path: ${{ steps.tests.outputs.coveragePath }}
|
||||
upload-coverage:
|
||||
needs: testAllModes
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pages: write
|
||||
id-token: write
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
steps:
|
||||
- name: Download all workflow run artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: coverage-results
|
||||
- name: Display structure of downloaded files
|
||||
run: ls -R coverage-results
|
||||
- name: Upload Pages artifact
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
path: coverage-results
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v4
|
||||
path: ${{ steps.tests.outputs.coveragePath }}
|
||||
Reference in New Issue
Block a user