Update installer.yml (#23) #60
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: installer | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
installer: | |
name: Compile installer on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macOS-latest, windows-latest] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
lfs: true | |
clean: true | |
- name: Setup Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: 18 | |
- uses: google/wireit@setup-github-actions-caching/v1 | |
- name: Download sing-box for Linux | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
mkdir -p artifacts/sing-box | |
wget -O ./sing-box.tar.gz https://github.com/SagerNet/sing-box/releases/download/v1.8.2/sing-box-1.8.2-linux-amd64.tar.gz | |
tar -xvzf ./sing-box.tar.gz -C ./artifacts/sing-box | |
mv artifacts/sing-box/**/sing-box controller/resources/sing-box | |
- name: Download sing-box for Mac | |
if: matrix.os == 'macOS-latest' | |
run: | | |
mkdir -p artifacts/sing-box | |
wget -O ./sing-box.tar.gz https://github.com/SagerNet/sing-box/releases/download/v1.8.2/sing-box-1.8.2-darwin-amd64.tar.gz | |
tar -xvzf ./sing-box.tar.gz -C ./artifacts/sing-box | |
mv artifacts/sing-box/**/sing-box controller/resources/sing-box | |
- name: Download sing-box for Windows | |
if: matrix.os == 'windows-latest' | |
shell: pwsh | |
run: | | |
mkdir -p artifacts/sing-box | |
Invoke-RestMethod -Uri https://github.com/SagerNet/sing-box/releases/download/v1.8.2/sing-box-1.8.2-windows-amd64.zip -OutFile sing-box.zip | |
Expand-Archive .\sing-box.zip -DestinationPath .\artifacts\sing-box | |
Move-Item -Path .\artifacts\sing-box\**\sing-box.exe -Destination .\controller\resources\sing-box\ | |
- name: Install dependencies for controller | |
run: npm ci | |
working-directory: ./controller | |
- name: Install dependencies for editor | |
run: npm ci | |
working-directory: ./editor | |
- name: Install dependencies for singland | |
run: npm ci | |
working-directory: ./singland | |
- name: Build for Unix | |
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macOS-latest' | |
run: | | |
npm run init-unix | |
npm run build | |
working-directory: ./singland | |
- name: Build for Windows | |
if: matrix.os == 'windows-latest' | |
run: | | |
npm run init-win | |
npm run build | |
working-directory: ./singland | |
- name: Publish installer for Linux | |
uses: actions/[email protected] | |
if: matrix.os == 'ubuntu-latest' | |
with: | |
name: installer-linux-amd64 | |
path: | | |
./singland/release/singland-*.tar.gz | |
./singland/release/singland_*_amd64.deb | |
./singland/release/singland-*.x86_64.rpm | |
if-no-files-found: error | |
- name: Publish installer for Mac | |
uses: actions/[email protected] | |
if: matrix.os == 'macOS-latest' | |
with: | |
name: installer-mac-amd64 | |
path: | | |
./singland/release/singland-*-mac.tar.gz | |
./singland/release/singland-*.dmg | |
if-no-files-found: error | |
- name: Publish installer for Windows | |
uses: actions/[email protected] | |
if: matrix.os == 'windows-latest' | |
with: | |
name: installer-windows-amd64 | |
path: | | |
./singland/release/singland*.exe | |
./singland/release/singland-*-win.zip | |
if-no-files-found: error |