Build and Publish #71
This file contains hidden or 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 | |
| packages: write | |
| 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@v6 | |
| - 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: "Release" | |
| needs: | |
| - backend-tests | |
| - tag | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - run: git fetch --force --tags | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: "go.mod" | |
| cache: true | |
| - uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: goreleaser/goreleaser-action@v7 | |
| with: | |
| distribution: goreleaser | |
| version: latest | |
| args: release --clean | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }} | |
| docs: | |
| name: "Deploy Docs" | |
| needs: | |
| - goreleaser | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/configure-pages@v6 | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: 3.x | |
| - run: pip install zensical | |
| - run: zensical build --clean | |
| - uses: actions/upload-pages-artifact@v5 | |
| with: | |
| path: site | |
| - uses: actions/deploy-pages@v5 | |
| id: deployment |