Skip to content

Commit

Permalink
Add nightly build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
gorkem committed Feb 8, 2024
1 parent 87dbb07 commit b4ba5a9
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/nightly-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
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

0 comments on commit b4ba5a9

Please sign in to comment.