Release #22
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: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
semver: | |
type: string | |
description: 'Semver (eg: v1.2.3)' | |
required: true | |
jobs: | |
release: | |
if: github.triggering_actor == 'samber' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.21 | |
stable: false | |
- name: Test | |
run: make test | |
# remove tests in order to clean dependencies | |
- name: Remove xxx_test.go files | |
run: rm -rf *_test.go ./examples ./images | |
- name: Set library version in version.go | |
run: sed -i 's/VERSION/${{ inputs.semver }}/g' version.go | |
# cleanup test dependencies | |
- name: Cleanup dependencies | |
run: go mod tidy | |
- name: List files | |
run: tree -Cfi | |
- name: Write new go.mod into logs | |
run: cat go.mod | |
- name: Write new go.sum into logs | |
run: cat go.sum | |
- name: Create tag | |
run: | | |
git config --global user.name '${{ github.triggering_actor }}' | |
git config --global user.email "${{ github.triggering_actor}}@users.noreply.github.com" | |
git add . | |
git commit --allow-empty -m 'bump ${{ inputs.semver }}' | |
git tag ${{ inputs.semver }} | |
git push origin ${{ inputs.semver }} | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: ${{ inputs.semver }} | |
tag_name: ${{ inputs.semver }} |