Build and Publish #132
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: Build and Publish | |
permissions: | |
contents: write # for release | |
pages: write | |
id-token: write | |
on: | |
workflow_dispatch: | |
inputs: | |
semverbump: | |
description: "Which version to bump by" | |
required: true | |
default: "patch" | |
type: choice | |
options: | |
- patch | |
- minor | |
- major | |
jobs: | |
backend-tests: | |
name: "Go Build/Test" | |
uses: ./.github/workflows/partial-tests.yml | |
tag: | |
name: "Publish Tag" | |
runs-on: ubuntu-latest | |
needs: | |
- backend-tests | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- uses: actions-ecosystem/action-get-latest-tag@v1 | |
id: get-latest-tag | |
- uses: actions-ecosystem/action-bump-semver@v1 | |
id: bump-semver | |
with: | |
current_version: ${{ steps.get-latest-tag.outputs.tag }} | |
level: ${{ inputs.semverbump }} | |
- uses: actions-ecosystem/action-push-tag@v1 | |
with: | |
tag: ${{ steps.bump-semver.outputs.new_version }} | |
message: "${{ steps.bump-semver.outputs.new_version }}: PR #${{ github.event.pull_request.number }} ${{ github.event.pull_request.title }}" | |
goreleaser: | |
name: "Publish Release" | |
needs: | |
- tag | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
with: | |
fetch-depth: 0 | |
- run: git fetch --force --tags | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: ">=1.22.0" | |
cache: true | |
- uses: goreleaser/goreleaser-action@v6 | |
with: | |
distribution: goreleaser | |
version: latest | |
args: release --rm-dist | |
env: | |
GITHUB_TOKEN: ${{ secrets.PUBLISH_TOKEN }} | |
build-docs: | |
runs-on: ubuntu-latest | |
needs: | |
- goreleaser | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Not needed if lastUpdated is not enabled | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: npm # or pnpm / yarn | |
cache-dependency-path: "docs" | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Install dependencies | |
working-directory: docs | |
run: npm ci | |
- name: Build with VitePress | |
working-directory: docs | |
run: npm run build | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: docs/docs/.vitepress/dist | |
# Deployment job | |
deploy-docs: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
needs: | |
- build-docs | |
runs-on: ubuntu-latest | |
name: Deploy | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |