Skip to content

Add nightly build workflow #3

Add nightly build workflow

Add nightly build workflow #3

Workflow file for this run

name: Nightly builds
on:
# workflow_dispatch so that it can be triggered manually if needed
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
concurrency: ${{ github.workflow }}
jobs:
platfor-builds:
runs-on: ubuntu-latest
strategy:
matrix:
os: [linux, darwin, windows]
arch: [amd64, arm64]
exclude:
- os: windows
arch: arm64
include:
- os: windows
archive_ext: zip
- os: linux
archive_ext: tar.gz
- os: darwin
archive_ext: tar.gz
name: "${{ matrix.os }}-${{ matrix.arch }}"
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Cross-compile
run: |
version="$(git describe --no-match --always --abbrev=9 --dirty --broken 2>/dev/null || git rev-parse --short HEAD 2>/dev/null)-nightly"
binName="jmm-$GOOS-$GOARCH"
if [ $GOOS == "windows" ]; then
binName="${binName}.exe"
fi
go build -o "$binName" \
-ldflags="-s -w" \
- name: Generate archive
run: |
if [ $GOOS == "windows" ]; then
zip -9 -y -r -q "jmm-${GOOS}-${GOARCH}.zip" "jmm-${GOOS}-${GOARCH}.exe"
else
tar -czvf "jmm-${GOOS}-${GOARCH}.tar.gz" "jmm-${GOOS}-${GOARCH}"
fi
- name: Upload artifacts
uses: WebFreak001/[email protected]
with:
upload_url: https://uploads.github.com/repos/jozu-ai/jmm/releases/140709733/assets{?name,label}",
release_id: 140709733
asset_path: jmm-${{ matrix.os }}-${{ matrix.arch }}.${{ matrix.archive_ext }}
asset_name: jmm-${{ matrix.os }}-${{ matrix.arch }}.${{ matrix.archive_ext }}
asset_content_type: application/zip
max_releases: 2