Go Build and Release and Clean #41
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: Go Build and Release and Clean | |
on: | |
push: | |
branches: | |
- main | |
- master | |
paths-ignore: | |
- 'docs/**' | |
- '.github/**' | |
- '**.md' | |
- 'LICENSE' | |
pull_request: | |
branches: | |
- main | |
- master | |
paths-ignore: | |
- 'docs/**' | |
- '.github/**' | |
- '**.md' | |
- 'LICENSE' | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'tag' | |
required: false | |
default: 'latest' | |
# use ${{ github.event.inputs.tag }} | |
jobs: | |
job1: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup golang | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 'stable' | |
- name: Remove old Releases | |
uses: dev-drprasad/delete-older-releases@v0.3.2 | |
with: | |
keep_latest: 0 | |
delete_tags: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build | |
run: | | |
git clone https://github.com/gek64/gobd.git | |
cd gobd | |
go build -o "${{ github.workspace }}/gobd_runner.exe" | |
cd ${{ github.workspace }} | |
go mod tidy | |
${{ github.workspace }}/gobd_runner.exe -os windows -d bin -no_debug -no_cgo | |
powershell -Command "Get-ChildItem -Recurse ./bin/* | Get-FileHash" > ./SHA256SUMS.txt | |
move ./SHA256SUMS.txt ./bin/SHA256SUMS.txt | |
- name: Release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "bin/*" | |
tag: 'latest' | |
token: ${{ secrets.GITHUB_TOKEN }} | |
generateReleaseNotes: true | |
removeArtifacts: true | |
replacesArtifacts: true | |
- name: Remove old artifacts | |
uses: c-hive/gha-remove-artifacts@v1 | |
with: | |
age: "0s" |