add select tag #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: ubuntu-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/[email protected] | |
with: | |
keep_latest: 0 | |
delete_tags: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build | |
run: | | |
# 编译gobd | |
git clone https://github.com/gek64/gobd.git | |
cd gobd | |
go build -o "${{ github.workspace }}/gobd_runner" | |
chmod +x "${{ github.workspace }}/gobd_runner" | |
# 编译程序 | |
cd ${{ github.workspace }} | |
# 获取版本信息 | |
echo "VERSION=$(go run . -v)" >> $GITHUB_ENV | |
# 批量编译 | |
go mod tidy | |
"${{ github.workspace }}/gobd_runner" -os linux -d bin -no_debug -no_cgo | |
"${{ github.workspace }}/gobd_runner" -os linux -arch mipsle -n ${{ github.event.repository.name }}-softfloat -d bin -no_debug -no_cgo -envs 'GOMIPS=softfloat' | |
# 获取sha256 checksum | |
sha256sum bin/* > bin/SHA256SUMS.txt | |
- name: Release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "bin/*" | |
tag: ${{ env.VERSION }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
generateReleaseNotes: true | |
removeArtifacts: true | |
replacesArtifacts: true | |
- name: Remove old artifacts | |
uses: c-hive/gha-remove-artifacts@v1 | |
with: | |
age: "0s" |