Skip to content

Release-Go-Binary

Release-Go-Binary #260

Workflow file for this run

name: 'Release-Go-Binary'
on:
workflow_dispatch:
pull_request:
release:
types: ['created']
jobs:
Release-Go-Binary:
name: ${{ matrix.goarch == 'arm' && format('{0}, {1}v{2}', matrix.goos, matrix.goarch, matrix.goarm) || format('{0}, {1}', matrix.goos, matrix.goarch) }}
runs-on: 'ubuntu-latest'
strategy:
fail-fast: false
matrix:
goos: [darwin, windows, linux, netbsd, openbsd, freebsd]
goarch: ['386', 'amd64', 'arm', 'arm64']
goarm: ['6']
include:
- goos: windows
goarch: 'arm'
goarm: '7'
- goos: linux
goarch: 'arm'
goarm: '5'
- goos: linux
goarch: '386'
pre_command: 'export CGO_ENABLED=0'
- goos: linux
goarch: 'amd64'
pre_command: 'export CGO_ENABLED=0'
- goos: linux
goarch: 'arm'
goarm: '7'
- goos: linux
goarch: 'mips'
pre_command: 'export GOMIPS=softfloat'
- goos: linux
goarch: 'mipsle'
pre_command: 'export GOMIPS=softfloat'
- goos: linux
goarch: 'mips64'
pre_command: 'export GOMIPS64=softfloat'
- goos: linux
goarch: 'mips64le'
pre_command: 'export GOMIPS64=softfloat'
- goos: linux
goarch: 'riscv64'
- goos: linux
goarch: 'ppc64'
- goos: linux
goarch: 'ppc64le'
- goos: solaris
goarch: 'amd64'
exclude:
- goos: darwin
goarch: '386'
- goos: darwin
goarch: 'arm'
- goos: windows
goarch: 'arm'
goarm: '6'
steps:
- name: 'Checkout'
uses: 'actions/checkout@v4'
- name: Set build info
id: build_info
run: |
echo "tag_version=$(basename ${GITHUB_REF}) (${{ matrix.goarch == 'arm' && format('{0}, {1}v{2}', matrix.goos, matrix.goarch, matrix.goarm) || format('{0}, {1}', matrix.goos, matrix.goarch) }})" >> "${GITHUB_OUTPUT}"
echo "nightly_build_name=$(basename ${GITHUB_REF})_`echo ${GITHUB_SHA} | cut -c1-7`" >> "${GITHUB_OUTPUT}"
echo "nightly_build_version=$(basename ${GITHUB_REF})_`echo ${GITHUB_SHA} | cut -c1-7` (${{ matrix.goarch == 'arm' && format('{0}, {1}v{2}', matrix.goos, matrix.goarch, matrix.goarm) || format('{0}, {1}', matrix.goos, matrix.goarch) }}) (Nightly)" >> "${GITHUB_OUTPUT}"
- name: ${{ github.event_name == 'release' && 'Build' || 'Build (Nightly)' }}
id: build
uses: 'wangyoucao577/go-release-action@v1.50'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
upload: ${{ github.event_name == 'release' && true || false }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goarm: ${{ matrix.goarm }}
ldflags: "-w -X \"main.programVersion=${{ github.event_name == 'release' && steps.build_info.outputs.tag_version || steps.build_info.outputs.nightly_build_version }}\""
pre_command: ${{ matrix.pre_command }}
goversion: 1.20.13
md5sum: false
sha256sum: false
binary_name: 'qBittorrent-ClientBlocker'
extra_files: 'lang/ LICENSE *.md config.json'
- name: 'Upload GitHub Artifact (Nightly)'
uses: actions/upload-artifact@v4
if: ${{ github.event_name != 'release' }}
with:
name: ${{ github.event.repository.name }}-${{ steps.build_info.outputs.nightly_build_name }}-${{ matrix.goarch == 'arm' && format('{0}-{1}v{2}', matrix.goos, matrix.goarch, matrix.goarm) || format('{0}-{1}', matrix.goos, matrix.goarch) }}
path: ${{ steps.build.outputs.release_asset_dir }}