CD #47
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: CD | |
on: | |
schedule: | |
- cron: "0 0 * * 3" | |
workflow_dispatch: | |
jobs: | |
ci: | |
name: CI | |
uses: ./.github/workflows/ci.yml | |
secrets: inherit | |
release: | |
name: Release | |
needs: [ci] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
with: | |
fetch-depth: 0 | |
- name: Check if version bumped | |
id: latest-tag | |
run: echo "tag=$(git describe --tags --abbrev=0)" >> "$GITHUB_OUTPUT" | |
- name: Dry run | |
uses: commitizen-tools/commitizen-action@1f11eb222996406681d2bfa1eb3d997eca46557c # 0.21.0 | |
with: | |
github_token: ${{ github.token }} | |
changelog_increment_filename: _changelog.md | |
dry_run: true | |
- name: Bump | |
id: cz | |
uses: commitizen-tools/commitizen-action@1f11eb222996406681d2bfa1eb3d997eca46557c # 0.21.0 | |
with: | |
github_token: ${{ github.token }} | |
changelog_increment_filename: _changelog.md | |
- name: Check if version bumped | |
id: check-tag | |
run: | | |
[ "${{ steps.latest-tag.outputs.tag }}" != "${{ steps.cz.outputs.version }}" ] && bump=true | |
echo "bump=$bump" >> "$GITHUB_OUTPUT" | |
- name: Setup Go | |
if: steps.check-tag.outputs.bump == 'true' | |
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 | |
with: | |
cache: true | |
check-latest: true | |
go-version-file: go.mod | |
- name: Run GoReleaser | |
if: steps.check-tag.outputs.bump == 'true' | |
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0 | |
with: | |
args: release --clean --release-notes _changelog.md | |
env: | |
AUR_KEY: ${{ secrets.AUR_KEY }} | |
GITHUB_TOKEN: ${{ github.token }} | |
page: | |
name: Page | |
needs: [ci] | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-22.04 | |
permissions: | |
actions: read | |
contents: read | |
id-token: write | |
pages: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deploy.outputs.page_url }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
- name: Setup Pages | |
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0 | |
- name: Setup Go | |
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 | |
with: | |
cache: true | |
check-latest: true | |
go-version-file: go.mod | |
- name: Get latest pandoc release | |
id: latest-pandoc-release | |
run: gh release view --repo jgm/pandoc --json assets --jq '.assets[].url' | grep amd64.deb | xargs -I {} echo url={} >> "GITHUB_OUTPUT" | |
- name: Install pandoc | |
run: ansible -b -m apt -a deb=${{ steps.latest-pandoc-release.outputs.url }} localhost | |
- name: Generate docs | |
run: make docs | |
- name: Upload artifacts | |
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1 | |
with: | |
path: docs/ | |
- name: Deploy pages | |
id: deploy | |
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5 |