Skip to content

Release

Release #662

Workflow file for this run

name: Release
on:
workflow_dispatch:
push:
tags:
- '*'
#schedule:
# - cron: "0 8 * * *"
jobs:
build:
strategy:
matrix:
include:
- os: macos-14
platform: 'mac'
# - os: windows-2019
# platform: 'win'
# - os: ubuntu-20.04
# platform: 'linux'
# - os: ubuntu-18.04
# platform: 'linux'
runs-on: ${{ matrix.os }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PRODUCT_NAME: "Mark Note"
steps:
- name: Set git config
run: |
git config --global core.autocrlf false
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup Python environment
uses: actions/setup-python@v4
with:
python-version: '3.11.5'
- name: Setup Node.js environment
uses: actions/setup-node@v2.1.2
with:
node-version: 22.x
- name: Install
run: |
yarn install
yarn electron-rebuild
node scripts/download-pandoc.js
node scripts/download-plantuml.js
- name: Set env
if: matrix.platform == 'mac'
run: |
echo "APPLEID=${{ secrets.APPLEID }}" >> $GITHUB_ENV
echo "APPLEIDPASS=${{ secrets.APPLEIDPASS }}" >> $GITHUB_ENV
echo "CSC_LINK=${{ secrets.CSC_LINK }}" >> $GITHUB_ENV
echo "CSC_KEY_PASSWORD=${{ secrets.CSC_KEY_PASSWORD }}" >> $GITHUB_ENV
#echo "TEAMID=${{ secrets.TEAMID }}" >> $GITHUB_ENV
- name: Build
run: |
yarn build
- name: Electron-Win
if: matrix.platform == 'win'
run: |
yarn run electron-builder --${{ matrix.platform }} -p never | sed 's/identityName=.*$//'
if (!(Test-Path out/win-unpacked/resources/app.asar.unpacked/node_modules/node-pty/build/Release/pty.node)) { throw 'node-pty not exist' }
- name: Electron-Mac
if: matrix.platform == 'mac'
run: |
## 下载外部依赖
sh ./scripts/download-ripgrep.sh
## 编译amd版本
yarn run electron-builder --${{ matrix.platform }} --x64 -p never | sed 's/identityName=.*$//'
find ./out -regex '.*app.asar.unpacked/node_modules/node-pty/build/Release/pty.node$' | grep pty.node
ls -alh out/*
mv out/latest-mac.yml out/latest-mac-x64.yml
## 编译arm64版本
yarn electron-rebuild --arch=arm64
sed -i '' 's/out\/mac\/$PRODUCT_NAME.app/out\/mac-arm64\/$PRODUCT_NAME.app/' electron-builder.json
yarn run electron-builder --${{ matrix.platform }} --arm64 -p never | sed 's/identityName=.*$//'
ls -alh out/*
mv out/latest-mac.yml out/latest-mac-arm64.yml
# 未知的操作
#cat out/latest-mac-arm64.yml out/latest-mac-x64.yml | sed '9,13d' > out/latest-mac.yml
- name: Electron-Linux
if: matrix.platform == 'linux'
run: |
yarn run electron-builder --${{ matrix.platform }} -p never | sed 's/identityName=.*$//'
find ./out -regex '.*app.asar.unpacked/node_modules/node-pty/build/Release/pty.node$' | grep pty.node
- name: Electron-Linux-Arm64
if: matrix.platform == 'linux' && matrix.os != 'ubuntu-18.04'
run: |
export npm_config_arch=arm64
node "./node_modules/@vscode/ripgrep/lib/postinstall.js" --force
node scripts/download-pandoc.js --force-arm64
yarn electron-rebuild --arch=arm64
yarn run electron-builder --${{ matrix.platform }} --arm64 -p never | sed 's/identityName=.*$//'
- name: Rename Artifact for Ubuntu-18.04
if: matrix.os == 'ubuntu-18.04'
run: |
mv out/*.deb out/`basename -s .deb out/*.deb`-ubuntu-18.04.deb
rm out/*.AppImage
- name: Setup Python environment
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: GH Release
uses: softprops/action-gh-release@v2.0.5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PRODUCT_NAME: "Note"
with:
prerelease: false
tag_name: ${{ github.ref_name }}
files: |
out/*${{ env.PRODUCT_NAME }}*.*
out/latest*.yml