feat: copy/paste step (#17) #90
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" ] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-20.04, macos-12] | |
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.22 | |
- 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/sektron && chmod +x bin/sektron | |
if: ${{ !startsWith(matrix.os, 'windows') }} | |
# Disable windows for now has I have no way of testing it. | |
# - name: Build windows | |
# run: go build -ldflags "-linkmode 'external' -extldflags '-static'" -o bin/sektron.exe | |
# if: startsWith(matrix.os, 'windows') | |
- name: Tar.gz files | |
run: tar -zcvf sektron_${{ github.ref_name }}_${{ runner.os}}.tar.gz LICENSE -C bin sektron | |
if: ${{ github.ref_type == 'tag' }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: sektron_${{ github.sha }} | |
path: sektron_${{ github.ref_name }}_${{ runner.os}}.tar.gz | |
if-no-files-found: error | |
if: ${{ github.ref_type == 'tag' }} | |
release: | |
needs: build | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: sektron_${{ github.sha }} | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: sektron_*.tar.gz |