Release #92
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 | |
on: | |
push: | |
tags: | |
- '*' | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
label: 'ubuntu' | |
- os: macos-latest | |
label: 'macos-arm' | |
- os: macos-13 | |
label: 'macos-x86' | |
runs-on: ${{ matrix.os }} | |
env: | |
LPAC_VERSION: v2.0.1 | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Modify version number | |
run: | | |
VERSION=$(grep 'Version' FyneApp.toml | sed 's/Version = "\(.*\)"/\1/' | xargs) | |
DATE=$(TZ=Asia/Shanghai date +"%Y-%m-%d") | |
if [[ "$RUNNER_OS" == "Linux" ]]; then | |
sed -i "s/const Version = \"development\"/const Version = \"$VERSION\"/" main.go | |
sed -i "s/const EUICCDataVersion = \"unknown\"/const EUICCDataVersion = \"$DATE\"/" main.go | |
elif [[ "$RUNNER_OS" == "macOS" ]]; then | |
sed -i '' "s/const Version = \"development\"/const Version = \"$VERSION\"/" main.go | |
sed -i '' "s/const EUICCDataVersion = \"unknown\"/const EUICCDataVersion = \"$DATE\"/" main.go | |
fi | |
- name: Setup go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '>=1.21.0' | |
- name: Setup Docker | |
if: runner.os == 'Linux' | |
uses: docker-practice/actions-setup-docker@master | |
- name: Setup toolchain | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y build-essential libgl1-mesa-dev xorg-dev libgtk-3-dev | |
go install fyne.io/fyne/v2/cmd/fyne@latest | |
go install github.com/fyne-io/fyne-cross@latest | |
- name: Build for Linux | |
if: runner.os == 'Linux' | |
run: | | |
go generate | |
go build -ldflags="-s -w" | |
chmod +x EasyLPAC | |
wget https://github.com/estkme-group/lpac/archive/refs/tags/$LPAC_VERSION.tar.gz -O lpac-$LPAC_VERSION-src.tar.gz | |
wget https://github.com/estkme-group/lpac/archive/refs/tags/$LPAC_VERSION.zip -O lpac-$LPAC_VERSION-src.zip | |
tar zcf EasyLPAC-linux-x86_64.tar.gz EasyLPAC lpac-$LPAC_VERSION-src.tar.gz LICENSE | |
- name: Build for Windows | |
if: runner.os == 'Linux' | |
run: | | |
go generate | |
fyne-cross windows --arch=amd64,arm64 --icon assets/icon64.png | |
cd fyne-cross/bin/windows-amd64 | |
wget https://github.com/estkme-group/lpac/releases/download/$LPAC_VERSION/lpac-windows-x86_64-mingw.zip -O lpac.zip | |
wget https://github.com/estkme-group/lpac/archive/refs/tags/$LPAC_VERSION.zip -O lpac-$LPAC_VERSION-src.zip | |
wget https://github.com/estkme-group/lpac/raw/main/src/LICENSE -O LICENSE-lpac | |
cp $GITHUB_WORKSPACE/LICENSE ./ | |
unzip lpac.zip && rm lpac.zip | |
zip -r $GITHUB_WORKSPACE/EasyLPAC-windows-x86_64-with-lpac.zip ./* | |
- name: Build for macOS ARM | |
if: matrix.label == 'macos-arm' | |
run: | | |
go install fyne.io/fyne/v2/cmd/fyne@latest | |
go generate | |
fyne package --icon assets/icon128.png --release | |
cd EasyLPAC.app/Contents/MacOS | |
wget https://github.com/estkme-group/lpac/releases/download/$LPAC_VERSION/lpac-darwin-universal.zip -O lpac.zip | |
unzip lpac.zip && rm lpac.zip | |
cd $GITHUB_WORKSPACE | |
wget https://github.com/estkme-group/lpac/archive/refs/tags/$LPAC_VERSION.zip -O lpac-$LPAC_VERSION-src.zip | |
wget https://github.com/estkme-group/lpac/raw/main/src/LICENSE -O LICENSE-lpac | |
zip -r EasyLPAC-macOS-arm64-with-lpac.zip EasyLPAC.app lpac-$LPAC_VERSION-src.zip LICENSE* | |
mkdir dmg && cp -r EasyLPAC.app lpac-$LPAC_VERSION-src.zip LICENSE* dmg | |
hdiutil create -volname "EasyLPAC" -srcfolder dmg -ov -format UDRW EasyLPAC.dmg | |
hdiutil attach EasyLPAC.dmg | |
cp assets/icon.icns /Volumes/EasyLPAC/.VolumeIcon.icns | |
SetFile -c icnC /Volumes/EasyLPAC/.VolumeIcon.icns | |
SetFile -a C /Volumes/EasyLPAC | |
hdiutil detach /Volumes/EasyLPAC | |
hdiutil convert EasyLPAC.dmg -format UDZO -o EasyLPAC-macOS-arm64-with-lpac.dmg | |
- name: Build for macOS x86 | |
if: matrix.label == 'macos-x86' | |
run: | | |
go install fyne.io/fyne/v2/cmd/fyne@latest | |
go generate | |
fyne package --icon assets/icon128.png --release | |
cd EasyLPAC.app/Contents/MacOS | |
wget https://github.com/estkme-group/lpac/releases/download/$LPAC_VERSION/lpac-darwin-universal.zip -O lpac.zip | |
unzip lpac.zip && rm lpac.zip | |
cd $GITHUB_WORKSPACE | |
wget https://github.com/estkme-group/lpac/archive/refs/tags/$LPAC_VERSION.zip -O lpac-$LPAC_VERSION-src.zip | |
wget https://github.com/estkme-group/lpac/raw/main/src/LICENSE -O LICENSE-lpac | |
zip -r EasyLPAC-macOS-x86_64-with-lpac.zip EasyLPAC.app lpac-$LPAC_VERSION-src.zip LICENSE* | |
mkdir dmg && cp -r EasyLPAC.app lpac-$LPAC_VERSION-src.zip LICENSE* dmg | |
hdiutil create -volname "EasyLPAC" -srcfolder dmg -ov -format UDRW EasyLPAC.dmg | |
hdiutil attach EasyLPAC.dmg | |
cp assets/icon.icns /Volumes/EasyLPAC/.VolumeIcon.icns | |
SetFile -c icnC /Volumes/EasyLPAC/.VolumeIcon.icns | |
SetFile -a C /Volumes/EasyLPAC | |
hdiutil detach /Volumes/EasyLPAC | |
hdiutil convert EasyLPAC.dmg -format UDZO -o EasyLPAC-macOS-x86_64-with-lpac.dmg | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-artifact-${{ matrix.label }} | |
path: | | |
EasyLPAC-windows-x86_64-with-lpac.zip | |
EasyLPAC-macOS-arm64-with-lpac.zip | |
EasyLPAC-macOS-arm64-with-lpac.dmg | |
EasyLPAC-macOS-x86_64-with-lpac.zip | |
EasyLPAC-macOS-x86_64-with-lpac.dmg | |
EasyLPAC-linux-x86_64.tar.gz | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
EasyLPAC-windows-x86_64-with-lpac.zip | |
EasyLPAC-macOS-arm64-with-lpac.zip | |
EasyLPAC-macOS-arm64-with-lpac.dmg | |
EasyLPAC-macOS-x86_64-with-lpac.zip | |
EasyLPAC-macOS-x86_64-with-lpac.dmg | |
EasyLPAC-linux-x86_64.tar.gz |