Skip to content

Commit

Permalink
fix: docs publish workflows
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Case <[email protected]>
  • Loading branch information
richardcase committed Jul 16, 2024
1 parent 6bf1b43 commit 2fd09ff
Show file tree
Hide file tree
Showing 10 changed files with 19,062 additions and 2,097 deletions.
79 changes: 46 additions & 33 deletions .github/workflows/deploy-docs.yaml
Original file line number Diff line number Diff line change
@@ -1,48 +1,61 @@
name: Documentation

on:
pull_request:
branches: [main]
push:
branches: [main]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

# Default to bash
defaults:
run:
shell: bash

jobs:
checks:
if: github.event_name != 'push'
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: "16.x"
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
node-version: 18
cache: npm
cache-dependency-path: 'userdocs/package-lock.json'
- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
- name: Install dependencies
working-directory: ./userdocs
run: npm install
- name: Build website
working-directory: ./userdocs
run: npm run build
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
go-version-file: "${{ github.workspace }}/go.mod"
check-latest: true
cache: false
- name: Build docs
run: make docs-build
path: ./build

release:
if: ${{ github.event_name != 'pull_request' && github.repository_owner == 'liquidmetal-dev' }}
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: "16.x"
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: "${{ github.workspace }}/go.mod"
- uses: webfactory/ssh-agent@dc588b651fe13675774614f8e6a936a468676387 # v0.9.0
with:
ssh-private-key: ${{ secrets.BOT_DEPLOY_KEY }}
- name: Release to GitHub Pages
env:
USE_SSH: true
GIT_USER: git
DEPLOYMENT_BRANCH: gh-pages
run: |
git config --global user.email "[email protected]"
git config --global user.name "liquidmetal-docs-bot"
make docs-deploy
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
30 changes: 30 additions & 0 deletions .github/workflows/test-docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Test docs build

on:
pull_request:
branches:
- main

jobs:
test-deploy:
name: Test docs build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: 18
cache: npm
cache-dependency-path: 'userdocs/package-lock.json'
- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
- name: Install dependencies
working-directory: ./userdocs
run: npm install
- name: Build website
working-directory: ./userdocs
run: npm run build
20 changes: 0 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -203,26 +203,6 @@ $(BUF): $(TOOLS_BIN_DIR) $(BUF_SHARE)
cp $(TOOLS_SHARE_DIR)/buf/bin/* $(TOOLS_BIN_DIR)
rm -rf $(TOOLS_SHARE_DIR)/buf

##@ Docs
.PHONY: docs-install
docs-install:
@if [ ! -d "userdocs/node_modules" ]; then \
echo " >>> yarn install"; \
cd ./userdocs && yarn install; \
fi

.PHONY: docs-build
docs-build: ## Build userdocs site
docs-build: generate-proto docs-install
cd ./userdocs && yarn build

.PHONY: docs-deploy
docs-deploy: docs-build
cd ./userdocs && \
DEPLOYMENT_BRANCH=gh-pages \
USE_SSH=true \
yarn deploy

##@ Utility

.PHONY: help
Expand Down
36 changes: 18 additions & 18 deletions api/services/microvm/v1alpha1/microvms.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2fd09ff

Please sign in to comment.