corso/.github/workflows/auto-version-docs.yml
2022-12-06 15:49:10 +05:30

61 lines
1.7 KiB
YAML

name: Auto version docs on release
on:
push:
# tags: ["v*.*.*"]
jobs:
Version-Docs:
environment: Testing
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Golang with cache
uses: magnetikonline/action-golang-cache@v3
with:
go-version-file: src/go.mod
- name: Generate CLI Docs
working-directory: ./src
run: |
go run ./cmd/mdgen/mdgen.go generate
# migrate generated md files into /website/docs/cli
- name: Move CLI .md to Docs
run: |
mkdir -p ./website/docs/cli
mv ./src/cmd/mdgen/cli_markdown/* ./website/docs/cli/
rm -R ./src/cmd/mdgen/cli_markdown/
- name: Create new version of docs
run: |
set -xe
cd website
# export VERSION="$(git describe --exact-match --tags $(git rev-parse HEAD))"
export VERSION="testing"
npm ci
npm run docusaurus docs:version "$VERSION"
- name: Build website
env:
CORSO_VERSION: ${{ needs.SetEnv.outputs.version }}
run: |
cd website &&
npm ci &&
npm run build
- uses: actions/upload-artifact@master
name: Upload website as artifacts
with:
name: website
path: website/build
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
commit-message: Add new version to versioned docs
title: Add new version to versioned docs
body: Creates a new versioned set of docs for the latest release to `versioned_docs`.
branch: versioned-docs-update