Skip to content

ci: linux build

ci: linux build #377

Workflow file for this run

name: Alpha Build
on:
push:
branches: [migrate-tauri-v2]
tags-ignore: [updater, alpha]
workflow_dispatch:
concurrency:
group: alpha-${{ github.ref }}
cancel-in-progress: true
permissions: write-all
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: short
jobs:
# alpha:
# strategy:
# fail-fast: false
# matrix:
# include:
# - os: windows-latest
# target: x86_64-pc-windows-msvc
# - os: windows-latest
# target: i686-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
# runs-on: ${{ matrix.os }}
# steps:
# - name: Checkout Repository
# uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 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@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2
# with:
# workspaces: src-tauri
# - name: Install Node
# uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # 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 }} --alpha
# - name: Tauri build
# uses: tauri-apps/tauri-action@8c3e0753aa015d00d03631d6d4f64ad59489251d # v0
# env:
# 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: "Clash Verge Self Alpha"
# releaseBody: "More new features are now supported."
# releaseDraft: false
# prerelease: true
# tauriScript: pnpm
# args: --target ${{ matrix.target }}
# - name: Portable Bundle
# if: matrix.os == 'windows-latest'
# run: pnpm portable ${{ matrix.target }} --alpha
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
alpha-for-linux:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
- os: ubuntu-22.04
target: i686-unknown-linux-gnu
- os: ubuntu-22.04
target: aarch64-unknown-linux-gnu
- os: ubuntu-22.04
target: armv7-unknown-linux-gnueabihf
outputs:
VERSION: ${{ steps.get_version.outputs.VERSION }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 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@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2
with:
workspaces: src-tauri
- name: Install Packages (x86_64)
if: matrix.target == 'x86_64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Get Version
id: get_version
run: |
sudo apt-get update
sudo apt-get install jq
echo "VERSION=$(cat package.json | jq '.version' | tr -d '"')" >> "$GITHUB_OUTPUT"
echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> "$GITHUB_ENV"
- name: Install Binstall
if: matrix.target != 'x86_64-unknown-linux-gnu'
uses: cargo-bins/cargo-binstall@main
- name: Install Cross
if: matrix.target != 'x86_64-unknown-linux-gnu'
run: cargo binstall -y cross
- name: Install Node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # 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 }} --alpha
- name: Tauri build (x86_64)
if: startsWith(matrix.target, 'x86_64')
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
run: |
pnpm build --target ${{ matrix.target }}
- name: Tauri build (other)
if: matrix.target != 'x86_64-unknown-linux-gnu'
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
RUST_BACKTRACE: full
run: |
pnpm build -r cross --target ${{ matrix.target }} -b deb,rpm
# - name: Build for Linux
# uses: ./.github/build-for-linux
# env:
# TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
# TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
# with:
# target: ${{ matrix.target }}
# alpha: true
- name: Upload Release
if: startsWith(matrix.target, 'x86_64')
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2
with:
tag_name: alpha
name: "Clash Verge Self Alpha"
prerelease: true
token: ${{ secrets.GITHUB_TOKEN }}
files: src-tauri/target/${{ matrix.target }}/release/bundle/appimage/*.AppImage*
- name: Upload Release
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2
with:
tag_name: alpha
name: "Clash Verge Self Alpha"
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
pkgbuild:
name: PKGBUILD for ArchLinux
needs: [alpha-for-linux]
strategy:
fail-fast: false
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Update Checksums
run: |
echo "version: ${{ needs.alpha-for-linux.outputs.VERSION }}"
wget https://github.com/oomeow/clash-verge-self/releases/download/alpha/clash-verge_${{ needs.alpha-for-linux.outputs.VERSION }}_amd64.deb -O amd64.deb
sed -i "s/sha256sums_x86_64=.*/sha256sums_x86_64=(\"$(sha256sum ./amd64.deb | awk '{print $1}')\")/" archbuild/alpha/PKGBUILD
- name: Makepkg Build and Check
id: makepkg
uses: CachyOS/pkgbuild-action@master
with:
pkgdir: archbuild/alpha
- name: Print Package Files
run: |
echo "Successfully created the following package archive"
echo "Package: ${{ steps.makepkg.outputs.pkgfile0 }}"
- name: Upload Release
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2
with:
tag_name: alpha
name: "Clash Verge Self Alpha"
prerelease: true
token: ${{ secrets.GITHUB_TOKEN }}
files: ${{ steps.makepkg.outputs.pkgfile0 }}
# update_tag:
# name: Update tag
# runs-on: ubuntu-22.04
# needs: [alpha, pkgbuild]
# steps:
# - name: Checkout repository
# uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
# - name: Set Env
# run: |
# echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV
# shell: bash
# - name: Update Tag
# uses: richardsimko/update-tag@e173a8ef8f54ab526a91dad6139a25efed62424c # v1
# with:
# tag_name: alpha
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Generate Changelog
# run: |
# cat >> ${{ github.workspace }}/CHANGELOG.md << 'EOF'
# [FAQ](https://clash-verge-rev.github.io/faq/windows.html)
# Created at ${{ env.BUILDTIME }}.
# EOF
# - name: Upload Release
# uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2
# with:
# tag_name: alpha
# name: "Clash Verge Self Alpha"
# body_path: ${{ github.workspace }}/CHANGELOG.md
# prerelease: true
# token: ${{ secrets.GITHUB_TOKEN }}
# generate_release_notes: true