Merge pull request #17 from SerRichard/SerRichard-patch-1 #11
Workflow file for this run
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: Build and Release | |
on: | |
push: | |
tags: | |
- '*.*.*' | |
jobs: | |
build: | |
name: Build Binaries | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
goos: [linux, darwin, windows] | |
goarch: [amd64] | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.23' | |
- name: Get the Tag | |
id: get_tag | |
run: echo "TAG_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV | |
- name: Build Binary | |
run: | | |
mkdir -p dist/ | |
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o dist/your-tool-${{ matrix.goos }}-${{ matrix.goarch }}-${{ env.TAG_NAME }} ./cli | |
- name: Compress Binary | |
if: matrix.goos != 'windows' | |
run: gzip dist/your-tool-${{ matrix.goos }}-${{ matrix.goarch }}-${{ env.TAG_NAME }} | |
- name: List files in dist with absolute path | |
run: ls dist/ | |
- name: Upload Release Asset | |
uses: actions/upload-artifact@v3 | |
with: | |
name: proteus-${{ matrix.goos }}-${{ matrix.goarch }} | |
path: dist/proteus-${{ matrix.goos }}-${{ matrix.goarch }}-${{ env.TAG_NAME }}* | |
release: | |
name: Create GitHub Release | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: dist/ | |
- name: Print current directory | |
run: pwd | |
- name: List files in dist with absolute path | |
run: ls ${{ github.workspace }} | |
- name: Create Release | |
id: create_release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: dist/proteus-darwin-amd64 dist/proteus-linux-amd64 dist/proteus-windows-amd64 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |