Skip to content

fix build

fix build #7

Workflow file for this run

name: Build and Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build:
name: Build and Package Release
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-15-intel
GOOS: darwin
GOARCH: amd64
target: darwin-amd64
ext: ""
- os: macos-14
GOOS: darwin
GOARCH: arm64
target: darwin-arm64
ext: ""
- os: ubuntu-latest
GOOS: linux
GOARCH: amd64
target: linux-amd64
ext: ""
- os: windows-latest
GOOS: windows
GOARCH: amd64
target: windows-amd64
ext: ".exe"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: web/package-lock.json
- name: Install UI dependencies
working-directory: web
run: npm install
- name: Build UI assets
working-directory: web
run: npm run build
- name: Install GUI dependencies (Linux)
if: matrix.GOOS == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev libgtk-3-dev pkg-config
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.25.3'
- name: Get tag name
shell: bash
run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Build binary
shell: bash
run: |
mkdir -p dist
GOOS=${{ matrix.GOOS }} GOARCH=${{ matrix.GOARCH }} go build -ldflags="${LDFLAGS}" -o "dist/xcstrings-translator-${{ matrix.target }}${{ matrix.ext }}" .
CGO_ENABLED=1 GOOS=${{ matrix.GOOS }} GOARCH=${{ matrix.GOARCH }} go build -tags gui -ldflags="${LDFLAGS}" -o "dist/xcstrings-translator-${{ matrix.target }}-gui${{ matrix.ext }}" .
chmod +x dist/*
- name: Package as ZIP
shell: bash
run: |
cd dist
zip "xcstrings-translator-${{ matrix.target }}.zip" "xcstrings-translator-${{ matrix.target }}${{ matrix.ext }}" "xcstrings-translator-${{ matrix.target }}-gui${{ matrix.ext }}"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: xcstrings-translator-${{ matrix.target }}
path: dist/xcstrings-translator-${{ matrix.target }}.zip
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: assets
- name: Display structure of downloaded files
run: ls -R assets
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
assets/*/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}