Skip to content

update

update #20

Workflow file for this run

name: release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
name: Build (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# ---- Windows ----
- target: windows-amd64
os: windows-latest
goos: windows
goarch: amd64
exe_ext: .exe
archive_ext: zip
build_gui: true
# ---- Linux ----
- target: linux-amd64
os: ubuntu-latest
goos: linux
goarch: amd64
exe_ext: ""
archive_ext: tar.gz
build_gui: true
- target: linux-arm64
os: ubuntu-latest
goos: linux
goarch: arm64
exe_ext: ""
archive_ext: tar.gz
build_gui: true
# ---- macOS ----
- target: darwin-amd64
os: macos-latest
goos: darwin
goarch: amd64
exe_ext: ""
archive_ext: tar.gz
build_gui: true
- target: darwin-arm64
os: macos-latest
goos: darwin
goarch: arm64
exe_ext: ""
archive_ext: tar.gz
build_gui: true
# ---- Android/Termux ----
- target: android-arm64
os: ubuntu-latest
goos: android
goarch: arm64
exe_ext: ""
archive_ext: tar.gz
build_gui: true
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Set up Node (GUI)
if: ${{ matrix.build_gui }}
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Build lyenv (core)
shell: bash
run: |
set -euo pipefail
mkdir -p dist
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} \
go build -trimpath \
-o dist/lyenv${{ matrix.exe_ext }} \
./cmd/lyenv
- name: Build GUI (frontend + backend)
if: ${{ matrix.build_gui }}
shell: bash
run: |
set -euo pipefail
# 1) Build frontend assets (Vite) and copy dist -> backend/dist (your script)
cd gui-mvp/frontend
if [ -f package-lock.json ] || [ -f npm-shrinkwrap.json ]; then
npm ci
else
npm install
fi
npm run build:prod
cd ../../
# 2) Build GUI backend inside its OWN module (gui-mvp/backend has its own go.mod)
pushd gui-mvp/backend
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} \
go build -trimpath \
-o ../../dist/lyenv-gui${{ matrix.exe_ext }} \
.
popd
- name: Prepare package folder
shell: bash
run: |
set -euo pipefail
ver="${GITHUB_REF_NAME}"
out="lyenv-${ver}-${{ matrix.target }}"
echo "PKG_OUT=$out" >> $GITHUB_ENV
mkdir -p "package/$out"
mkdir -p release
cp dist/lyenv* "package/$out"/
if [ "${{ matrix.build_gui }}" = "true" ]; then
cp dist/lyenv-gui* "package/$out"/
fi
cp README.md LICENSE "package/$out"/ || true
- name: Package (Windows zip)
if: ${{ matrix.goos == 'windows' }}
shell: pwsh
run: |
$out = "${env:PKG_OUT}"
$src = "package/$out"
$dst = "release/$out.zip"
if (Test-Path $dst) { Remove-Item $dst -Force }
Compress-Archive -Path $src -DestinationPath $dst -Force
- name: Package (tar.gz)
if: ${{ matrix.goos != 'windows' }}
shell: bash
run: |
set -euo pipefail
out="${PKG_OUT}"
(cd package && tar -czf "../release/${out}.tar.gz" "${out}")
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: release-${{ matrix.target }}
path: release/*
if-no-files-found: error
publish:
name: Publish Release
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v5
with:
path: ./release-assets
- name: List assets
run: ls -R ./release-assets
- name: Create/Update Release and upload assets
uses: softprops/action-gh-release@v2
with:
files: |
release-assets/**/*
generate_release_notes: true