|
| 1 | +name: Publish |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: ["released"] |
| 6 | + |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + version: |
| 10 | + description: "Version" |
| 11 | + type: string |
| 12 | + required: true |
| 13 | + |
| 14 | +jobs: |
| 15 | + build_and_publish_wiki: |
| 16 | + name: Build and Publish GitHub Wiki |
| 17 | + runs-on: ubuntu-latest |
| 18 | + environment: Publish |
| 19 | + permissions: |
| 20 | + contents: write |
| 21 | + steps: |
| 22 | + - name: Checkout |
| 23 | + uses: actions/checkout@v3 |
| 24 | + with: |
| 25 | + fetch-depth: 0 |
| 26 | + - name: Setup Node.js |
| 27 | + uses: actions/setup-node@v3 |
| 28 | + with: |
| 29 | + node-version: "lts/*" |
| 30 | + - uses: pnpm/action-setup@v2 |
| 31 | + name: Install pnpm |
| 32 | + id: pnpm-install |
| 33 | + with: |
| 34 | + run_install: false |
| 35 | + - name: Get pnpm store directory |
| 36 | + id: pnpm-cache |
| 37 | + shell: bash |
| 38 | + run: | |
| 39 | + echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT |
| 40 | + - uses: actions/cache@v3 |
| 41 | + name: Setup pnpm cache |
| 42 | + with: |
| 43 | + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} |
| 44 | + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} |
| 45 | + restore-keys: | |
| 46 | + ${{ runner.os }}-pnpm-store- |
| 47 | + - name: Install dependencies |
| 48 | + run: pnpm install |
| 49 | + - name: Build documentations |
| 50 | + run: pnpm exec concurrently "pnpm:build:docs:site" "pnpm:build:docs:wiki" |
| 51 | + - name: Publish GitHub Wiki |
| 52 | + uses: Andrew-Chen-Wang/github-wiki-action@v4 |
| 53 | + with: |
| 54 | + commit-message: "chore(publish): GitHub Wiki for ${{ inputs.version || github.ref_name || github.sha }} [skip ci]" |
| 55 | + - name: Upload GitHub Pages Artifacts |
| 56 | + uses: actions/upload-pages-artifact@v2 |
| 57 | + with: |
| 58 | + path: "site/" |
| 59 | + publish_pages: |
| 60 | + name: Publish GitHub Pages |
| 61 | + needs: build_and_publish_wiki |
| 62 | + runs-on: ubuntu-latest |
| 63 | + environment: |
| 64 | + name: github-pages |
| 65 | + url: ${{ steps.deployment.outputs.page_url }} |
| 66 | + permissions: |
| 67 | + pages: write |
| 68 | + id-token: write |
| 69 | + steps: |
| 70 | + - name: Setup GitHub Pages |
| 71 | + uses: actions/configure-pages@v3 |
| 72 | + - name: Publish GitHub Pages |
| 73 | + id: deployment |
| 74 | + uses: actions/deploy-pages@v2 |
0 commit comments