Skip to content

Release-Go-Binary

Release-Go-Binary #186

Workflow file for this run

name: 'Release-Go-Binary'
on:
workflow_dispatch:
pull_request:
release:
types: ['created']
jobs:
Release-Go-Binary:
runs-on: 'ubuntu-latest'
strategy:
fail-fast: false
matrix:
goos: [darwin, windows, linux, netbsd, openbsd, freebsd]
goarch: ['386', 'amd64', 'arm', 'arm64']
include:
- goos: darwin
no_upx_compression: true
- goos: windows
goarch: 'arm'
no_upx_compression: true
- goos: windows
goarch: 'arm64'
no_upx_compression: true
- goos: linux
goarch: 'mips'
pre_command: 'export GOMIPS=softfloat'
no_upx_compression: true
- goos: linux
goarch: 'mipsle'
pre_command: 'export GOMIPS=softfloat'
no_upx_compression: true
- goos: linux
goarch: 'mips64'
pre_command: 'export GOMIPS64=softfloat'
no_upx_compression: true
- goos: linux
goarch: 'mips64le'
pre_command: 'export GOMIPS64=softfloat'
no_upx_compression: true
- goos: linux
goarch: 'riscv64'
no_upx_compression: true
- goos: linux
goarch: 'ppc64'
- goos: linux
goarch: 'ppc64le'
- goos: netbsd
no_upx_compression: true
- goos: openbsd
no_upx_compression: true
- goos: freebsd
no_upx_compression: true
- goos: solaris
goarch: 'amd64'
exclude:
- goos: darwin
goarch: '386'
- goos: darwin
goarch: 'arm'
steps:
- name: 'Checkout'
uses: 'actions/checkout@v4'
- name: Set build info
id: build_info
run: |
echo "tag_version=$(basename ${GITHUB_REF}) (${{ 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.goos }}, ${{ matrix.goarch }})" >> "${GITHUB_OUTPUT}"
- name: ${{ github.event_name == 'release' && 'Build' || 'Build (Nightly Build)' }}
id: build
uses: 'wangyoucao577/go-release-action@v1'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
upload: ${{ github.event_name == 'release' && true || false }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
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 }}
executable_compression: ${{ matrix.no_upx_compression != true && 'upx -v -9' || '' }}
goversion: 1.20.13
md5sum: false
sha256sum: false
binary_name: 'qBittorrent-ClientBlocker'
extra_files: 'LICENSE README.md config.json'
- name: 'Upload GitHub Artifact (Nightly Build)'
uses: actions/upload-artifact@v4
if: ${{ github.event_name != 'release' }}
with:
name: ${{ github.event.repository.name }}-${{ steps.build_info.outputs.nightly_build_name }}-${{ matrix.goos }}-${{ matrix.goarch }}
path: ${{ steps.build.outputs.release_asset_dir }}