Dev Build #57
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: Dev Build | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "15 0 * * *" # 每天 08:15 UTC+8 自动构建 | |
env: | |
CARGO_INCREMENTAL: 0 | |
RUST_BACKTRACE: short | |
jobs: | |
release: | |
strategy: | |
matrix: | |
targets: | |
- os: windows-latest | |
category: nsis # and portable | |
# - os: windows-latest | |
# category: msi | |
- os: ubuntu-latest | |
category: all | |
- os: macos-13 | |
category: amd64 | |
- os: macos-13 | |
category: aarch64 | |
runs-on: ${{ matrix.targets.os }} | |
if: startsWith(github.repository, 'LibNyanpasu') | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: install Rust stable | |
run: | | |
rustup install stable --profile minimal --no-self-update | |
rustup default stable | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: "./backend/" | |
prefix-key: "rust-stable" | |
key: ${{ matrix.targets.os }} | |
shared-key: "release" | |
- name: Install the missing rust target (macOS Only) | |
if: startsWith(matrix.targets.os, 'macos-') && matrix.targets.category == 'aarch64' | |
run: | | |
rustup target add aarch64-apple-darwin | |
- 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: Delete current release assets | |
if: startsWith(matrix.targets.os, 'ubuntu-') | |
uses: mknejp/delete-release-assets@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: pre-release | |
fail-if-no-assets: false | |
fail-if-no-release: false | |
assets: | | |
*.zip | |
*.gz | |
*.AppImage | |
*.deb | |
*.dmg | |
*.msi | |
*.sig | |
*.exe | |
*.json | |
- name: Install Dependencies (Ubuntu Only) | |
if: startsWith(matrix.targets.os, 'ubuntu-') | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf openssl | |
- uses: maxim-lobanov/setup-xcode@v1 | |
if: startsWith(matrix.targets.os, 'macos-') | |
with: | |
xcode-version: "15.0" | |
- name: Pnpm install and check | |
run: | | |
pnpm i | |
pnpm check | |
- name: Nightly Prepare | |
if: startsWith(matrix.targets.os, 'windows-') == false | |
run: | | |
pnpm prepare:nightly | |
- name: Nightly Prepare (MSI only) | |
if: startsWith(matrix.targets.os, 'windows-') && matrix.targets.category == 'msi' | |
run: | | |
pnpm prepare:nightly --msi | |
- name: Nightly Prepare (Windows NSIS and Portable) | |
if: startsWith(matrix.targets.os, 'windows-') && matrix.targets.category == 'nsis' | |
run: | | |
pnpm prepare:nightly --nsis | |
- name: Tauri build | |
if: startsWith(matrix.targets.os, 'macos-') == false || matrix.targets.category != 'aarch64' | |
uses: tauri-apps/tauri-action@v0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} | |
with: | |
tagName: pre-release | |
releaseName: "Clash Nyanpasu Dev" | |
releaseBody: "More new features are now supported." | |
releaseDraft: false | |
prerelease: true | |
tauriScript: pnpm tauri | |
args: -f nightly -c ./backend/tauri/tauri.nightly.conf.json | |
- name: Portable Bundle (Windows Only) | |
if: startsWith(matrix.targets.os, 'windows-') && matrix.targets.category == 'nsis' | |
run: | | |
pnpm portable | |
env: | |
TAG_NAME: pre-release | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} | |
VITE_WIN_PORTABLE: 1 | |
- name: Pnpm check (macOS aarch64) | |
if: startsWith(matrix.targets.os, 'macos-') && matrix.targets.category == 'aarch64' | |
run: | | |
pnpm check --arch arm64 --sidecar-host aarch64-apple-darwin | |
- name: Tauri build with Upload (macOS aarch64) | |
if: startsWith(matrix.targets.os, 'macos-') && matrix.targets.category == 'aarch64' | |
env: | |
TAG_NAME: pre-release | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} | |
run: | | |
pnpm build:nightly --target aarch64-apple-darwin | |
pnpm upload:osx-aarch64 | |
update_tag: | |
name: Update tag | |
runs-on: ubuntu-latest | |
needs: [release] | |
if: startsWith(github.repository, 'LibNyanpasu') | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set Env | |
run: | | |
echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV | |
echo "CURRENT_GIT_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV | |
shell: bash | |
- name: Update Tag | |
uses: greenhat616/update-tag@v1 | |
with: | |
tag_name: pre-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- run: | | |
cat > release.txt << 'EOF' | |
## Clash Nyanpasu Nightly Build | |
Release created at ${{ env.BUILDTIME }}. | |
Daily build of **Clash Nyanpasu** on *main* branch. | |
***[See the development log here](https://t.me/keikolog/462)*** | |
EOF | |
- name: Update Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: Clash Nyanpasu Dev | |
tag_name: pre-release | |
body_path: release.txt | |
prerelease: true | |
generate_release_notes: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
updater: | |
name: Update Nightly Updater | |
runs-on: ubuntu-latest | |
needs: [release, update_tag] | |
if: startsWith(github.repository, 'LibNyanpasu') | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-tags: true # Fetch all tags | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
run_install: false | |
- name: Pnpm install | |
run: pnpm i | |
- name: Update Updater | |
run: pnpm updater:nightly | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
telegram: | |
name: Notify Telegram | |
runs-on: ubuntu-latest | |
needs: [release, update_tag] | |
if: startsWith(github.repository, 'LibNyanpasu') | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: latest | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
run_install: false | |
- name: Pnpm install | |
run: pnpm i | |
- name: Send Releases | |
run: pnpm send-notify:nightly | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }} | |
TELEGRAM_API_ID: ${{ secrets.TELEGRAM_API_ID }} | |
TELEGRAM_API_HASH: ${{ secrets.TELEGRAM_API_HASH }} | |
TELEGRAM_TO: "@keikolog" | |
TELEGRAM_TO_NIGHTLY: "@ClashNyanpasu" |