Skip to content

Commit

Permalink
ci: add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
RealShadowNova committed Jun 10, 2022
1 parent 3d07752 commit b93cacf
Showing 1 changed file with 93 additions and 0 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Documentation

on:
push:
branches:
- main
tags:
- 'v*'

jobs:
build:
name: Build Documentation
runs-on: ubuntu-latest

if: github.repository_owner == 'RealShadowNova'
steps:
- name: Checkout Project
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
- name: Use Node.js v16
uses: actions/setup-node@17f8bd926464a1afa4c6a11669539e9c1ba77048 # tag=v3
with:
node-version: 16
cache: yarn
registry-url: https://registry.npmjs.org/
- name: Install Dependencies
run: yarn --immutable
- name: Build Documentation
run: yarn docs
- name: Upload Documentation Artifacts
uses: actions/cache@v2
with:
name: docs
path: docs/api.json
- name: Set Output
id: env
run: |
echo "::set-output name=NAME::${GITHUB_REF_NAME}"
echo "::set-output name=TYPE::${GITHUB_REF_TYPE}"
echo "::set-output name=SHA::${GITHUB_SHA}"
upload:
name: Upload Documentation
needs: build
runs-on: ubuntu-latest
env:
NAME: ${{ needs.build.outputs.REF }}
TYPE: ${{ needs.build.outputs.TYPE }}
SHA: ${{ needs.build.outputs.SHA }}
steps:
- name: Checkout Project
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
- name: Use Node.js v16
uses: actions/setup-node@17f8bd926464a1afa4c6a11669539e9c1ba77048 # tag=v3
with:
node-version: 16
cache: yarn
registry-url: https://registry.npmjs.org/
- name: Install Dependencies
run: yarn --immutable
- name: Download Documentation Artifacts
uses: actions/download-artifact@v2
with:
name: docs
path: docs
- name: Checkout Documentation Project
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
with:
repository: 'RealShadowNova/docs'
path: 'out'

- name: Move Documentation
if: ${{ env.TYPE == 'tag' }}
env:
SEMVER: ${{ env.NAME }}
run: |
mkdir -p out/property-helpers
mv docs/api.json out/property-helpers/${SEMVER}.json
- name: Move Documentation
if: ${{ env.TYPE == 'branch' }}
run: |
mkdir -p out/property-helpers
mv docs/api.json out/property-helpers/${NAME}.json
- name: Commit & Push
run: |
cd out
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git add .
git commit -m "docs(property-helpers): build for ${TYPE} ${NAME}: ${SHA}"
git push

0 comments on commit b93cacf

Please sign in to comment.