Skip to content

Commit

Permalink
Merge pull request #28 from conkayyan/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
conkayyan authored Feb 4, 2024
2 parents bfc6a6b + cf94dca commit 0ff73a1
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 189 deletions.
156 changes: 36 additions & 120 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,133 +1,49 @@
name: Release
name: Wails build

on:
push:
tags:
# Match any new tag
- '*'

release:

types: [ created ]
env:
# Necessary for most environments as build failure can occur due to OOM issues
NODE_OPTIONS: "--max-old-space-size=4096"

jobs:

build:

strategy:
# Failure in one platform build won't impact the others
fail-fast: false
matrix:
include:
- runs-on: ubuntu-latest
binary-name: hosts-switch_linux_amd64_${{ github.ref_name }}
binary-path: ./build/linux/
format: '.deb'
- runs-on: windows-latest
binary-name: hosts-switch_windows_amd64_${{ github.ref_name }}
binary-path: ./build/bin/
format: '.exe'
- runs-on: macos-latest
binary-name: hosts-switch_darwin_amd64_${{ github.ref_name }}
binary-path: ./build/bin/
format: '.app'

runs-on: ${{ matrix.runs-on }}

build:
- name: 'hosts-switch-linux-amd64'
platform: 'linux/amd64'
os: 'ubuntu-latest'
- name: 'hosts-switch-windows-amd64'
platform: 'windows/amd64'
os: 'windows-latest'
- name: 'hosts-switch'
platform: 'darwin/universal'
os: 'macos-latest'

runs-on: ${{ matrix.build.os }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Nodejs
uses: actions/setup-node@v2
with:
node-version: v16.14.2
registry-url: https://registry.npmjs.com/

- name: Install Vue Dependencies
run: |
cd frontend
npm install
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21.2

- name: Set up Linux Environment
if: ${{ matrix.runs-on == 'ubuntu-latest' }}
run: |
sudo apt-get install libwebkit2gtk-4.0-dev
sudo apt install libgtk-3-dev
sudo apt install nsis
#- name: Run Windows UPX
# if: ${{ matrix.runs-on == 'windows-latest' }}
# uses: crazy-max/ghaction-upx@v2
# with:
# version: v3.96
# files: |
# ./build/bin/hosts-switch.exe
# args: -fq

#- name: Set Windows UPX
# run: setx -m PATH '%PATH%;C:\hostedtoolcache\windows\ghaction-upx\3.96\x64\upx-3.96-win64\'

- name: Install Wails
run: go install github.com/wailsapp/wails/v2/cmd/[email protected]

- name: Check Environment
run: wails doctor

- name: Build Linux
if: ${{ matrix.runs-on == 'ubuntu-latest' }}
run: |
cd scripts
sh build-linux-deb.sh ${{ github.ref_name }}
- name: Build Windows
if: ${{ matrix.runs-on == 'windows-latest' }}
# run: wails build --clean --platform windows -nsis -webview2 embed
run: |
wails build --clean --platform windows -webview2 Embed
cd ${{ matrix.binary-path }}
ren hosts-switch.exe ${{ matrix.binary-name }}${{ matrix.format }}
- name: Build MacOs
if: ${{ matrix.runs-on == 'macos-latest' }}
run: |
wails build --clean --platform darwin/amd64
cd ${{ matrix.binary-path }}
mv hosts-switch.app ${{ matrix.binary-name }}${{ matrix.format }}
- name: Archive Release
uses: thedoctor0/zip-release@main
with:
type: zip
filename: ${{ matrix.binary-name }}.zip
directory: ${{ matrix.binary-path }}
path: .
# exclusions: '*.git* /*node_modules/* .editorconfig'

- name: Get release
id: get_release
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Upload Release Asset
if: ${{ matrix.runs-on != 'macos-latest' }}
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: actions/checkout@v2
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ${{ matrix.binary-path }}${{ matrix.binary-name }}${{ matrix.format }}
asset_name: ${{ matrix.binary-name }}${{ matrix.format }}
asset_content_type: application/octet-stream
submodules: recursive

- name: Upload Release Zip Asset
id: upload-release-zip-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build wails
# uses: dAppServer/[email protected]
uses: conkayyan/wails-build-action@dev
id: build
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ${{ matrix.binary-path }}${{ matrix.binary-name }}.zip
asset_name: ${{ matrix.binary-name }}.zip
asset_content_type: application/zip
build-name: ${{ matrix.build.name }}
build-platform: ${{ matrix.build.platform }}
package: true
go-version: '1.21.2'
wails-version: 'v2.7.1'
node-version: '16.14.2'
deb-app: hosts-switch
deb-app-name: "Hosts Switch"
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ To build a redistributable, production mode package, use `wails build`.

## Download

Linux: [hosts-switch_linux_amd64_v0.1.0.deb](https://github.com/conkayyan/hosts-switch/releases/download/v0.1.0/hosts-switch_linux_amd64_v0.1.0.deb), [hosts-switch_linux_amd64_v0.1.0.zip](https://github.com/conkayyan/hosts-switch/releases/download/v0.1.0/hosts-switch_linux_amd64_v0.1.0.zip)
Linux: [hosts-switch-linux-amd64.deb](https://github.com/conkayyan/hosts-switch/releases/latest/download/hosts-switch-linux-amd64.deb), [hosts-switch-linux-amd64](https://github.com/conkayyan/hosts-switch/releases/latest/download/hosts-switch-linux-amd64)

Windows: [hosts-switch_windows_amd64_v0.1.0.exe](https://github.com/conkayyan/hosts-switch/releases/download/v0.1.0/hosts-switch_windows_amd64_v0.1.0.exe), [hosts-switch_windows_amd64_v0.1.0.zip](https://github.com/conkayyan/hosts-switch/releases/download/v0.1.0/hosts-switch_windows_amd64_v0.1.0.zip)
Windows: [hosts-switch-windows-amd64](https://github.com/conkayyan/hosts-switch/releases/latest/download/hosts-switch-windows-amd64), [hosts-switch-amd64-installer.exe](https://github.com/conkayyan/hosts-switch/releases/latest/download/hosts-switch-amd64-installer.exe)

MacOs: [hosts-switch_darwin_amd64_v0.1.0.zip](https://github.com/conkayyan/hosts-switch/releases/download/v0.1.0/hosts-switch_darwin_amd64_v0.1.0.zip)
MacOs: [hosts-switch.pkg](https://github.com/conkayyan/hosts-switch/releases/latest/download/hosts-switch.pkg), [hosts-switch.app.zip](https://github.com/conkayyan/hosts-switch/releases/latest/download/hosts-switch.app.zip)
15 changes: 8 additions & 7 deletions scripts/build-linux-deb.sh
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/sh
release=$(printf %s "$1" | tr -d "v")
app=hosts-switch
app_name="Hosts Switch"
app_dir=${app}_linux_amd64_v${release}
app=$(printf %s "$2")
app_name=$(printf %s "$3")
app_dir=${app}-linux-amd64

cd ../

Expand All @@ -12,8 +12,7 @@ mkdir -p build/linux/${app_dir}/usr/share/icons/hicolor/1024x1024/apps
mkdir -p build/linux/${app_dir}/usr/share/icons/hicolor/256x256/apps
mkdir -p build/linux/${app_dir}/DEBIAN

wails build --clean --platform linux/amd64
cp build/bin/hosts-switch build/linux/${app_dir}/usr/bin/${app}
cp build/bin/${app}-linux-amd64 build/linux/${app_dir}/usr/bin/${app}

cp build/appicon.png build/linux/${app_dir}/usr/share/icons/hicolor/1024x1024/apps/${app}.png
cp build/appicon.png build/linux/${app_dir}/usr/share/icons/hicolor/256x256/apps/${app}.png
Expand All @@ -36,8 +35,10 @@ Section: base
Priority: optional
Architecture: amd64
Maintainer: conkay <conkay@foxmail.com>
Description: Hosts Switch
Description: ${app_name}
Homepage: https://github.com/conkayyan/${app}
EOF

dpkg-deb --build build/linux/${app_dir}
rm -rf build/linux/${app_dir}
mv build/linux/${app_dir}.deb build/bin/
rm -rf build/linux
9 changes: 0 additions & 9 deletions scripts/build-macos-arm.sh

This file was deleted.

9 changes: 0 additions & 9 deletions scripts/build-macos-intel.sh

This file was deleted.

9 changes: 0 additions & 9 deletions scripts/build-macos.sh

This file was deleted.

9 changes: 0 additions & 9 deletions scripts/build-windows.sh

This file was deleted.

9 changes: 0 additions & 9 deletions scripts/build.sh

This file was deleted.

14 changes: 0 additions & 14 deletions scripts/install-wails-cli.sh

This file was deleted.

0 comments on commit 0ff73a1

Please sign in to comment.