fix windows release #29
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 | |
on: | |
push: | |
branches: ["main"] | |
tags: ["v*"] | |
pull_request: | |
branches: ["main"] | |
permissions: | |
contents: write | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-20.04, macos-13, windows-2019] | |
runs-on: ${{ matrix.os }} | |
env: | |
CGO_ENABLED: 1 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Alsa headers | |
run: sudo apt-get install libasound2-dev | |
if: startsWith(matrix.os, 'ubuntu') | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.23 | |
- name: Release version number | |
run: echo '${{ github.ref_name}}' > VERSION | |
if: ${{ github.ref_type == 'tag' }} | |
- name: Development version number | |
run: echo 'dev-${{ github.sha}}' > VERSION | |
if: ${{ github.ref_type == 'branch' }} | |
- name: Build linux|mac | |
run: go build -o bin/signls && chmod +x bin/signls | |
if: ${{ !startsWith(matrix.os, 'windows') }} | |
- name: Build windows | |
run: go build -ldflags "-linkmode 'external' -extldflags '-static'" -o bin/signls.exe | |
if: startsWith(matrix.os, 'windows') | |
- name: Tar.gz files | |
run: tar -zcvf signls_${{ github.ref_name }}_${{ runner.os}}.tar.gz LICENSE -C bin signls | |
if: ${{ github.ref_type == 'tag'&& !startsWith(matrix.os, 'windows') }} | |
- name: Zip files | |
shell: pwsh | |
run: | | |
Compress-Archive bin\signls.exe LICENSE signls_${{ github.ref_name }}_${{ runner.os}}.zip | |
if: ${{ startsWith(matrix.os, 'windows') }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: signls_${{ github.sha }}_${{ runner.os}} | |
path: signls_${{ github.ref_name }}_${{ runner.os}}.tar.gz | |
if-no-files-found: error | |
if: ${{ github.ref_type == 'tag' && !startsWith(matrix.os, 'windows') }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: signls_${{ github.sha }}_${{ runner.os}} | |
path: signls_${{ github.ref_name }}_${{ runner.os}}.zip | |
if-no-files-found: error | |
if: ${{ startsWith(matrix.os, 'windows') }} | |
release: | |
needs: build | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
with: | |
name: signls_${{ github.sha }}_macOS | |
- uses: actions/[email protected] | |
with: | |
name: signls_${{ github.sha }}_Linux | |
- uses: actions/[email protected] | |
with: | |
name: signls_${{ github.sha }}_Windows | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: signls_*.tar.gz |