Merge branch 'main' of https://github.com/dotpostcard/postcards-go #43
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: Bump version & release | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
bump-version: | |
if: "!startsWith(github.event.head_commit.message, 'bump:')" | |
runs-on: ubuntu-latest | |
name: "Bump version and create changelog with commitizen" | |
outputs: | |
new_version: ${{ steps.new_version.outputs.version }} | |
steps: | |
- name: Check out | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Create bump and changelog | |
uses: commitizen-tools/commitizen-action@master | |
with: | |
github_token: ${{ secrets.GH_TOKEN }} | |
- name: Extract new version | |
if: success() | |
id: new_version | |
run: | | |
VERSION=$(git describe --tags --exact-match 2> /dev/null || true) | |
[[ ! -z $VERSION ]] && echo "version=${VERSION}" >> $GITHUB_OUTPUT || true | |
goreleaser: | |
needs: bump-version | |
if: "${{ needs.bump-version.outputs.new_version != '' }}" | |
runs-on: ubuntu-latest | |
name: Release binaries as Github releases | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ needs.bump-version.outputs.new_version }} | |
fetch-depth: 0 | |
- run: git fetch --force --tags | |
- uses: actions/setup-go@v3 | |
with: | |
go-version-file: go.mod | |
- name: Setup release environment | |
run: | | |
echo 'GITHUB_TOKEN=${{ secrets.GH_TOKEN }}' > .release-env | |
- name: Publish release to Github | |
run: make release |