CD #20
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 | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
needs: [ci] | |
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@5742e2a039330cbb23ebf35f046f814d4c6ff811 # v5.1.0 | |
with: | |
args: release --clean --release-notes _changelog.md | |
env: | |
GITHUB_TOKEN: ${{ github.token }} |