Skip to content

ci: 自动发布 release(draft: false) #35

ci: 自动发布 release(draft: false)

ci: 自动发布 release(draft: false) #35

Workflow file for this run

name: Build & Release
on:
push:
branches: [main]
tags: ['v*']
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
platform: mac
artifact: dmg
- os: windows-latest
platform: win
artifact: exe
- os: ubuntu-latest
platform: linux
artifact: appimage
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci
- name: Build (electron-vite)
run: npm run build
- name: Prepare vendor/opencli
run: |
mkdir -p vendor/opencli
npm run vendor:opencli
- name: Package (electron-builder)
run: npx electron-builder --publish never
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform }}-${{ matrix.artifact }}
path: |
release/*.dmg
release/*.exe
release/*.AppImage
release/*.yml
if-no-files-found: warn
retention-days: 30
release:
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
# 自动发布:CI 构建完成后直接公开 release,electron-updater 立即可见。
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
draft: false
generateReleaseNotes: true
artifacts: |
artifacts/**/*.dmg
artifacts/**/*.exe
artifacts/**/*.AppImage
artifacts/**/*.yml
allowUpdates: true
updateOnlyUnreleased: true