feishin/.github/workflows/nightly-release.yml
2025-10-11 13:06:51 -07:00

108 lines
3.8 KiB
YAML

name: Nightly Release
on:
# schedule:
# - cron: '0 2 * * *'
workflow_dispatch:
jobs:
publish:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
steps:
- name: Checkout git repo
uses: actions/checkout@v1
- name: Install Node and PNPM
uses: pnpm/action-setup@v4.1.0
with:
version: 9
- name: Install dependencies
run: pnpm install
- name: Bump version and add beta suffix
run: |
# Get current version from package.json
CURRENT_VERSION=$(node -p "require('./package.json').version")
echo "Current version: $CURRENT_VERSION"
# Extract major, minor, patch components
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION"
# Increment patch version
NEW_PATCH=$((PATCH + 1))
# Create new version with beta suffix
NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}-beta"
echo "New version: $NEW_VERSION"
# Update package.json
node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
pkg.version = '$NEW_VERSION';
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 4) + '\n');
"
echo "Updated package.json version to: $NEW_VERSION"
# - name: Build and Publish releases (Windows)
# if: matrix.os == 'windows-latest'
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# uses: nick-invision/retry@v2.8.2
# with:
# timeout_minutes: 30
# max_attempts: 3
# retry_on: error
# command: |
# pnpm run package:win
# pnpm run publish:win
# on_retry_command: pnpm cache delete
# - name: Build and Publish releases (macOS)
# if: matrix.os == 'macos-latest'
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# uses: nick-invision/retry@v2.8.2
# with:
# timeout_minutes: 30
# max_attempts: 3
# retry_on: error
# command: |
# pnpm run package:mac
# pnpm run publish:mac
# on_retry_command: pnpm cache delete
# - name: Build and Publish releases (Linux)
# if: matrix.os == 'ubuntu-latest'
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# uses: nick-invision/retry@v2.8.2
# with:
# timeout_minutes: 30
# max_attempts: 3
# retry_on: error
# command: |
# pnpm run package:linux
# pnpm run publish:linux
# on_retry_command: pnpm cache delete
# - name: Build and Publish releases (Linux ARM64)
# if: matrix.os == 'ubuntu-latest'
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# uses: nick-invision/retry@v2.8.2
# with:
# timeout_minutes: 30
# max_attempts: 3
# retry_on: error
# command: |
# pnpm run package:linux-arm64
# pnpm run publish:linux-arm64
# on_retry_command: pnpm cache delete