Skip to content

build for more systems #31

build for more systems

build for more systems #31

Workflow file for this run

name: Test, Lint and Build
on:
push:
paths-ignore:
- "*.md"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
goos: [ linux, windows, darwin ]
goarch: [ amd64, 386, arm, arm64 ]
exclude:
- goos: darwin
goarch: 386
- goos: darwin
goarch: arm
- goos: windows
goarch: arm
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22.x
- name: File Extension Windows
if: ${{ matrix.goos == 'windows' }}
run: echo "file_extension=.exe" >> $GITHUB_ENV
- name: Prepare Version Info
run: |
echo "VERSION=$(git describe --tags --always)" >> $GITHUB_ENV
echo "COMMIT=$(git rev-parse HEAD)" >> $GITHUB_ENV
echo $GITHUB_ENV
- name: Build
run: |
CGO_ENABLED=1
go build -ldflags="-X 'main.Version=${{ env.VERSION }}' -X 'main.Commit=${{ env.COMMIT }}'" -o dist/gopad-${{ matrix.goos }}-${{ matrix.goarch }}${{ env.file_name }} go.gopad.dev/gopad
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: gopad-${{ matrix.goos }}-${{ matrix.goarch }}
path: dist/gopad-${{ matrix.goos }}-${{ matrix.goarch }}${{ env.file_name }}
- name: Release
if: ${{ github.event_name == 'release' }}
uses: ncipollo/release-action@v1
with:
artifacts: dist/gopad-${{ matrix.goos }}-${{ matrix.goarch }}${{ env.file_name }}
allowUpdates: true
omitBodyDuringUpdate: true
omitDraftDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true