feature + fix: fix bug in updater logic #56
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: Alpha Build | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main] | |
tags-ignore: [updater, alpha] | |
permissions: write-all | |
env: | |
CARGO_INCREMENTAL: 0 | |
RUST_BACKTRACE: short | |
concurrency: | |
# only allow per workflow per commit (and not pr) to run at a time | |
group: '${{ github.workflow }} - ${{ github.head_ref || github.ref }}' | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
jobs: | |
alpha: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
- os: windows-latest | |
target: aarch64-pc-windows-msvc | |
- os: macos-latest | |
target: aarch64-apple-darwin | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
- os: ubuntu-22.04 | |
target: x86_64-unknown-linux-gnu | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Install Rust Stable | |
uses: dtolnay/rust-toolchain@stable | |
- name: Add Rust Target | |
run: rustup target add ${{ matrix.target }} | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: src-tauri | |
cache-all-crates: true | |
cache-on-failure: true | |
- name: Install dependencies (ubuntu only) | |
if: matrix.os == 'ubuntu-22.04' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev patchelf | |
- name: Install Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
run_install: false | |
- name: Pnpm install and check | |
run: | | |
pnpm i | |
pnpm check ${{ matrix.target }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Add SENTRY_DSN to .env | |
run: | | |
echo "SENTRY_DSN=${{ secrets.SENTRY_DSN }}" >> .env | |
shell: bash | |
- name: CI Build | |
if: ${{ github.ref_type == 'branch' }} | |
run: | | |
pnpm build --target ${{ matrix.target }} | |
env: | |
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} | |
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} | |
- name: CI upload Windows x64 | |
if: ${{ github.ref_type == 'branch' && matrix.os == 'windows-latest' && matrix.target == 'x86_64-pc-windows-msvc' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: 'Windows Installers x64' | |
path: | | |
src-tauri/target/${{ matrix.target }}/release/bundle/msi/*.msi | |
src-tauri/target/${{ matrix.target }}/release/bundle/nsis/*.exe | |
- name: CI upload Windows arm64 | |
if: ${{ github.ref_type == 'branch' && matrix.os == 'windows-latest' && matrix.target == 'aarch64-pc-windows-msvc' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: 'Windows Installers arm64' | |
path: | | |
src-tauri/target/${{ matrix.target }}/release/bundle/msi/*.msi | |
src-tauri/target/${{ matrix.target }}/release/bundle/nsis/*.exe | |
- name: CI upload macOS x64 | |
if: ${{ github.ref_type == 'branch' && matrix.os == 'macos-latest' && matrix.target == 'x86_64-apple-darwin' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: 'macOS x64 Installer' | |
path: | | |
src-tauri/target/${{ matrix.target }}/release/bundle/dmg/*.dmg | |
- name: CI upload macOS arm64 | |
if: ${{ github.ref_type == 'branch' && matrix.os == 'macos-latest' && matrix.target == 'aarch64-apple-darwin' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: 'macOS arm64 Installer' | |
path: | | |
src-tauri/target/${{ matrix.target }}/release/bundle/dmg/*.dmg | |
- name: CI upload Linux | |
if: ${{ github.ref_type == 'branch' && matrix.os == 'ubuntu-22.04' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: 'Linux Distributions x64' | |
path: | | |
src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb | |
src-tauri/target/${{ matrix.target }}/release/bundle/rpm/*.rpm | |
# src-tauri/target/${{ matrix.target }}/release/bundle/AppImage/*.AppImage | |
- name: Tauri build | |
uses: tauri-apps/tauri-action@v0 | |
if: ${{ github.ref_type == 'tag' }} | |
env: | |
CI: true | |
NODE_OPTIONS: '--max_old_space_size=4096' | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} | |
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} | |
with: | |
tagName: alpha | |
releaseName: '${{ env.APP_NAME }} Alpha v__VERSION__' | |
releaseBody: 'More new features are now supported.' | |
releaseDraft: false | |
prerelease: true | |
tauriScript: pnpm | |
args: --target ${{ matrix.target }} | |
alpha-for-linux-arm: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-22.04 | |
target: aarch64-unknown-linux-gnu | |
arch: arm64 | |
- os: ubuntu-22.04 | |
target: armv7-unknown-linux-gnueabihf | |
arch: armhf | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Install Rust Stable | |
uses: dtolnay/rust-toolchain@stable | |
- name: Add Rust Target | |
run: rustup target add ${{ matrix.target }} | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: src-tauri | |
cache-all-crates: true | |
- name: Install Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
run_install: false | |
- name: Pnpm install and check | |
run: | | |
pnpm i | |
pnpm check ${{ matrix.target }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Add SENTRY_DSN and VITE_UPDATER_ACTIVE to .env | |
run: | | |
echo "SENTRY_DSN=${{ secrets.SENTRY_DSN }}" >> .env | |
echo "VITE_UPDATER_ACTIVE=true" >> .env | |
shell: bash | |
- name: 'Setup for linux' | |
run: |- | |
sudo ls -lR /etc/apt/ | |
cat > /tmp/sources.list << EOF | |
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu jammy main multiverse universe restricted | |
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu jammy-security main multiverse universe restricted | |
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu jammy-updates main multiverse universe restricted | |
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu jammy-backports main multiverse universe restricted | |
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy main multiverse universe restricted | |
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy-security main multiverse universe restricted | |
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy-updates main multiverse universe restricted | |
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy-backports main multiverse universe restricted | |
EOF | |
sudo mv /etc/apt/sources.list /etc/apt/sources.list.default | |
sudo mv /tmp/sources.list /etc/apt/sources.list | |
sudo dpkg --add-architecture ${{ matrix.arch }} | |
sudo apt update | |
sudo apt install -y \ | |
libwebkit2gtk-4.1-dev:${{ matrix.arch }} \ | |
libayatana-appindicator3-dev:${{ matrix.arch }} \ | |
libssl-dev:${{ matrix.arch }} \ | |
patchelf:${{ matrix.arch }} \ | |
librsvg2-dev:${{ matrix.arch }} | |
- name: 'Install aarch64 tools' | |
if: matrix.target == 'aarch64-unknown-linux-gnu' | |
run: | | |
sudo apt install -y \ | |
gcc-aarch64-linux-gnu \ | |
g++-aarch64-linux-gnu | |
- name: 'Install armv7 tools' | |
if: matrix.target == 'armv7-unknown-linux-gnueabihf' | |
run: | | |
sudo apt install -y \ | |
gcc-arm-linux-gnueabihf \ | |
g++-arm-linux-gnueabihf | |
- name: Build for Linux | |
run: | | |
export PKG_CONFIG_ALLOW_CROSS=1 | |
if [ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" ]; then | |
export PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig/:$PKG_CONFIG_PATH | |
export PKG_CONFIG_SYSROOT_DIR=/usr/aarch64-linux-gnu/ | |
elif [ "${{ matrix.target }}" == "armv7-unknown-linux-gnueabihf" ]; then | |
export PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig/:$PKG_CONFIG_PATH | |
export PKG_CONFIG_SYSROOT_DIR=/usr/arm-linux-gnueabihf/ | |
fi | |
pnpm build --target ${{ matrix.target }} | |
env: | |
NODE_OPTIONS: '--max_old_space_size=4096' | |
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} | |
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} | |
- name: CI upload Linux | |
if: ${{ github.ref_type == 'branch' && matrix.os == 'ubuntu-22.04' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: 'Linux Distributions ${{ matrix.target }}' | |
path: | | |
src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb | |
src-tauri/target/${{ matrix.target }}/release/bundle/rpm/*.rpm | |
- name: Get Version | |
run: | | |
sudo apt-get update | |
sudo apt-get install jq | |
echo "VERSION=$(jq -r '.version' src-tauri/tauri.conf.json)" >> $GITHUB_ENV | |
echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV | |
- name: Upload Release | |
if: ${{ github.ref_type == 'tag' }} | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: alpha | |
name: 'V2rayX Alpha' | |
body: 'More new features are now supported.' | |
prerelease: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: | | |
src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb | |
src-tauri/target/${{ matrix.target }}/release/bundle/rpm/*.rpm |