Skip to content

Release Desktop

Release Desktop #4

name: Release Desktop
on:
workflow_dispatch:
inputs:
target:
description: 输入打包版本号
required: true
jobs:
create-tag:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TOKEN }}
- name: Git config
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Git target
run: |
TAG_NAME="${{ github.event.inputs.target }}"
git tag $TAG_NAME
git push origin $TAG_NAME --force
- name: Get Commit Logs
id: get_logs
run: |
COMMITS=$(git log ${{ github.event.inputs.target }}..HEAD --oneline)
echo "COMMITS=$COMMITS" >> $GITHUB_ENV
- name: Create Release
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GH_TOKEN }}
name: 🎉Release ${{ github.event.inputs.target }}
tag_name: ${{ github.event.inputs.target }}
body: ${{ env.COMMITS }}
# - name: Linux target
# run: |
# TAG_NAME="${{ github.event.inputs.target }}.Linux"
# git tag $TAG_NAME
# git push origin $TAG_NAME --force
# - name: Mac target
# run: |
# TAG_NAME="${{ github.event.inputs.target }}.Mac"
# git tag $TAG_NAME
# git push origin $TAG_NAME --force
electron-package:
needs: create-tag
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
include:
- os: macos-latest
package_command: npm run package -- --mac
platform: Mac
- os: ubuntu-latest
package_command: npm run package -- --linux
platform: Linux
- os: windows-latest
package_command: npm run package -- --win
platform: Windows
steps:
- name: Check out
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
# 前端打包
- name: Install UI dependencies
run: cd ui && npm ci
- name: Build UI
env:
VITE_MOD: LOCAL # electron 打包需要
VITE_APP_BASE_URL: ./
run: cd ui && npm run build-only
- name: Install Main dependencies
run: npm ci
- name: Package Application
env:
NODE_ENV: production
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: ${{ matrix.package_command }}
- name: Show Builds
if: ${{ matrix.platform == 'Windows' }}
run: dir build
- name: Show Builds
if: ${{ matrix.platform != 'Windows' }}
run: ls -la build
- name: Mac Release
uses: softprops/action-gh-release@v2
if: ${{ matrix.platform == 'Mac' }}
with:
token: ${{ secrets.GH_TOKEN }}
name: 🎉Release ${{ github.event.inputs.target }}
tag_name: ${{ github.event.inputs.target }}
append_body: true
# Cashbook-2.0.0-arm64.dmg
files: build/Cashbook-${{ github.event.inputs.target }}-arm64.dmg
- name: Linux Release
uses: softprops/action-gh-release@v2
if: ${{ matrix.platform == 'Linux' }}
with:
token: ${{ secrets.GH_TOKEN }}
name: 🎉Release ${{ github.event.inputs.target }}
tag_name: ${{ github.event.inputs.target }}
append_body: true
# Cashbook_2.0.0_amd64.deb/Cashbook-2.0.0.AppImage
files: |
build/Cashbook_${{ github.event.inputs.target }}_amd64.deb
build/Cashbook-${{ github.event.inputs.target }}.AppImage
- name: Wiindows Release
uses: softprops/action-gh-release@v2
if: ${{ matrix.platform == 'Windows' }}
with:
# make_latest: "true"
token: ${{ secrets.GH_TOKEN }}
name: 🎉Release ${{ github.event.inputs.target }}
tag_name: ${{ github.event.inputs.target }}
append_body: true
# Cashbook Setup 2.0.0.exe
files: build/Cashbook Setup ${{ github.event.inputs.target }}.exe