Skip to content

Commit

Permalink
Update workflow to use template
Browse files Browse the repository at this point in the history
  • Loading branch information
adamgraham committed Oct 22, 2023
1 parent 7e8b2e2 commit 240a2b9
Showing 1 changed file with 10 additions and 86 deletions.
96 changes: 10 additions & 86 deletions .github/workflows/generate_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,90 +10,14 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
BASE_PATH: com.zigurous.tweening
PACKAGE_TITLE: "Tweening System"

jobs:
build:
name: Build
runs-on: windows-latest
steps:
- name: Checkout package
uses: actions/checkout@v3
with:
token: ${{ secrets.DOCS_TOKEN }}

- name: Checkout docs template
uses: actions/checkout@v3
with:
repository: zigurous/docs-template
ref: unity-package
token: ${{ secrets.DOCS_TOKEN }}
path: docs~

- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x

- name: Setup docfx
uses: crazy-max/ghaction-chocolatey@v1
with:
args: install docfx

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 14
cache: yarn
cache-dependency-path: docs~/yarn.lock

- name: Install dependencies
working-directory: docs~
run: yarn install
env:
NPM_TOKEN: ${{ secrets.DOCS_TOKEN }}

- name: Generate documentation
working-directory: docs~
run: yarn generate $env:BASE_PATH $env:PACKAGE_TITLE
env:
NPM_TOKEN: ${{ secrets.DOCS_TOKEN }}

- name: Build docs
working-directory: docs~
continue-on-error: false
run: yarn build
env:
NPM_TOKEN: ${{ secrets.DOCS_TOKEN }}

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: docs
path: docs~/public

publish:
name: Publish
needs: build
runs-on: windows-latest
steps:
- name: Dispatch workflow
uses: actions/github-script@v6
with:
github-token: ${{ secrets.DOCS_TOKEN }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'zigurous',
repo: 'docs',
ref: 'main',
workflow_id: 'publish_artifact.yml',
inputs: {
destination_path: process.env.BASE_PATH,
artifact_repo: process.env.GITHUB_REPOSITORY,
artifact_commit: process.env.GITHUB_SHA,
artifact_workflow: 'generate_docs.yml',
artifact_name: 'docs'
}
})
generate:
name: Docs
uses: zigurous/docs/.github/workflows/unity-package.yml@main
with:
package_title: "Tweening System"
package_base_path: com.zigurous.tweening
package_workflow: generate-docs.yml
package_artifact: docs
secrets:
token: ${{ secrets.DOCS_TOKEN }}

0 comments on commit 240a2b9

Please sign in to comment.