docs: add CI/CD page, closes #48 #278
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: [push] | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
pages: write | |
id-token: write | |
jobs: | |
backend: | |
name: Backend | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.21" | |
- name: Vet | |
run: go vet ./... | |
- name: Test | |
run: go test ./... --cover | |
frontend: | |
name: Frontend | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: cmd/serve/front | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: npm | |
- name: Install dependencies | |
run: npm ci | |
- name: Check | |
run: npm run check | |
- name: Test | |
run: npm test | |
build-docs: | |
name: Build docs | |
concurrency: | |
group: pages | |
cancel-in-progress: false | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: npm | |
- name: Setup Pages | |
uses: actions/configure-pages@v4 | |
- name: Install dependencies | |
run: npm ci | |
- name: Build with VitePress | |
run: npm run docs:build | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: docs/.vitepress/dist | |
deploy-docs: | |
if: github.ref_name == 'main' | |
name: Deploy docs | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
needs: build-docs | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
release: | |
name: Release | |
if: github.ref_name == 'main' | |
runs-on: ubuntu-latest | |
needs: [backend, frontend] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: npm | |
- name: Release | |
run: npx -p @semantic-release/git -p @semantic-release/exec semantic-release | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
- name: Build and push # Use a custom action to enable caching | |
uses: docker/build-push-action@v4 | |
if: env.docker_publish == 'true' | |
with: | |
context: . | |
push: true | |
platforms: linux/amd64,linux/arm64/v8 | |
tags: ${{ env.docker_tags }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |