chore: simplify ldflags reference #5
Workflow file for this run
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: go-releaser | |
on: | |
push: | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+*" | |
jobs: | |
update-changelog: | |
name: Create release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: requarks/changelog-action@v1 | |
name: "Update CHANGELOG" | |
id: changelog | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ github.ref_name }} | |
- uses: softprops/action-gh-release@v2 | |
name: "Add changes to release notes" | |
with: | |
body: ${{ steps.changelog.outputs.changes }} | |
- name: Commit CHANGELOG.md | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
branch: master | |
commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]' | |
file_pattern: CHANGELOG.md | |
releases-matrix: | |
name: Release Go Binary | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# build and publish in parallel: linux/386, linux/amd64, linux/arm64, windows/386, windows/amd64, darwin/amd64, darwin/arm64 | |
goos: [linux, darwin] | |
goarch: ["386", amd64, arm64] | |
exclude: | |
- goarch: "386" | |
goos: darwin | |
steps: | |
- name: "Get Release Info" | |
run: | | |
echo "RELEASE_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV | |
echo "PACKAGE_NAME=${GITHUB_REPOSITORY}" >> $GITHUB_ENV | |
if [ "${{ matrix.goos }}" == "darwin" ]; then | |
echo "OS_NAME=macOS" >> $GITHUB_ENV | |
else | |
echo "OS_NAME=${{ matrix.goos }}" >> $GITHUB_ENV | |
fi | |
- uses: actions/checkout@v3 | |
- uses: wangyoucao577/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
goos: ${{ matrix.goos }} | |
goarch: ${{ matrix.goarch }} | |
goversion: "1.22" | |
asset_name: '${{ env.REPOSITORY_NAME }}-${{ env.RELEASE_TAG }}-${{ env.OS_NAME }}-${{ matrix.goarch }}' | |
compress_assets: FALSE | |
executable_compression: upx -v | |
md5sum: false | |
ldflags: '-X main.Version=${{ env.RELEASE_TAG }}' | |