Skip to content

feat: runtime build

feat: runtime build #2

Workflow file for this run

name: Release
on:
push:
tags: ["v*"]
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- goos: linux
goarch: amd64
- goos: linux
goarch: arm64
- goos: darwin
goarch: amd64
- goos: darwin
goarch: arm64
- goos: windows
goarch: amd64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
cache-dependency-path: compiler/go.sum
- uses: oven-sh/setup-bun@v2
- name: Build UI bundle
run: |
cd go-runtime/haira/ui
bun install --frozen-lockfile || true
bun build src/index.ts --outfile dist/haira-ui.js --minify --target browser
- name: Get version
id: version
run: echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: "0"
run: |
VERSION="${{ steps.version.outputs.tag }}"
BINARY="haira"
if [ "${{ matrix.goos }}" = "windows" ]; then
BINARY="haira.exe"
fi
cd compiler && go build -ldflags "-X main.version=${VERSION}" -o "${BINARY}" .
- name: Package
run: |
VERSION="${{ steps.version.outputs.tag }}"
NAME="haira-${VERSION}-${{ matrix.goos }}-${{ matrix.goarch }}"
mkdir -p "${NAME}/bin"
BINARY="haira"
if [ "${{ matrix.goos }}" = "windows" ]; then
BINARY="haira.exe"
fi
cp "compiler/${BINARY}" "${NAME}/bin/"
cp -r go-runtime "${NAME}/runtime"
cp LICENSE "${NAME}/"
cp README.md "${NAME}/"
if [ "${{ matrix.goos }}" = "windows" ]; then
zip -r "${NAME}.zip" "${NAME}"
echo "ARCHIVE=${NAME}.zip" >> "$GITHUB_ENV"
else
tar czf "${NAME}.tar.gz" "${NAME}"
echo "ARCHIVE=${NAME}.tar.gz" >> "$GITHUB_ENV"
fi
- name: Checksum
run: sha256sum "${{ env.ARCHIVE }}" > "${{ env.ARCHIVE }}.sha256"
- name: Upload
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARCHIVE }}
path: |
${{ env.ARCHIVE }}
${{ env.ARCHIVE }}.sha256
publish:
needs: release
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Create release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
dist/*