fix: github release #90
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release suo5 | |
on: | |
push: | |
branches: | |
- 'release**' | |
- 'main' | |
release: | |
types: [ published ] | |
permissions: | |
contents: read | |
jobs: | |
build-binary: | |
name: Build cli | |
strategy: | |
fail-fast: true | |
matrix: | |
include: | |
- os: windows | |
arch: amd64 | |
output: suo5-windows-amd64.exe | |
- os: darwin | |
arch: amd64 | |
output: suo5-darwin-amd64 | |
- os: darwin | |
arch: arm64 | |
output: suo5-darwin-arm64 | |
- os: linux | |
arch: amd64 | |
output: suo5-linux-amd64 | |
- os: linux | |
arch: arm64 | |
output: suo5-linux-arm64 | |
runs-on: ubuntu-latest | |
env: | |
CGO_ENABLED: 0 | |
GOOS: ${{ matrix.os }} | |
GOARCH: ${{ matrix.arch }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '1.20' | |
- run: go build -trimpath -ldflags "-w -s -extldflags '-static' -X main.Version=${{ github.ref_name }}" -o target/${{ matrix.output }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: target | |
path: target/* | |
build-gui: | |
name: Build gui | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: windows-latest | |
platform: windows/amd64 | |
output: suo5-gui-windows.exe | |
- os: macos-latest | |
platform: darwin/universal | |
# wails bug, mac 的 output file 不生效, 先用这个保证能用 | |
output: suo5 | |
- os: ubuntu-latest | |
platform: linux/amd64 | |
output: suo5-gui-linux | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Bump manifest version | |
if: startsWith(github.ref, 'refs/tags/') | |
working-directory: gui | |
run: node version.js ${{ github.ref_name }} | |
- run: npm install && npm run build | |
working-directory: gui/frontend | |
- uses: dAppServer/[email protected] | |
with: | |
build-name: ${{ matrix.output }} | |
build-platform: ${{ matrix.platform }} | |
app-working-directory: gui | |
wails-build-webview2: embed | |
nsis: false | |
go-version: '1.20' | |
package: false | |
- if: runner.os == 'macOS' | |
shell: bash | |
working-directory: gui | |
run: | | |
rm -rf ./build/bin/${{ matrix.output }}.app.zip | |
ditto -c -k --keepParent ./build/bin/${{matrix.output}}.app ./build/bin/${{matrix.output}}.app.zip | |
rm -rf ./build/bin/${{ matrix.output }}.app | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: target | |
path: gui/build/bin/* | |
collect-release: | |
name: Collect and release | |
needs: [ build-binary, build-gui ] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: target | |
path: target | |
- run: ls -al target && ls -R target/ | |
- working-directory: target | |
run: | | |
rm -rf suo5-amd64-installer.exe | |
rm -rf suo5.pkg | |
mv suo5.app.zip suo5-gui-darwin.app.zip | |
- run: ls -al target && ls -R target/ && file target/ | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: target-release | |
path: target/* | |
# release assets | |
- uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: target/* |