Skip to content

Instantly share code, notes, and snippets.

@mundane799699
Last active June 24, 2024 14:32
Show Gist options
  • Save mundane799699/8b0e454bd5f1fa43000fc1c2752bd30d to your computer and use it in GitHub Desktop.
Save mundane799699/8b0e454bd5f1fa43000fc1c2752bd30d to your computer and use it in GitHub Desktop.
github action的workflow文件,用于electron打包,请放在项目目录/.github/workflows下面
name: BuildElectron
on:
workflow_dispatch:
jobs:
buildwin:
name: BuildWindows
runs-on: windows-latest
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm install
- name: Build and package
run: npm run build
- name: Filter Build Artifacts
shell: bash
run: |
mkdir -p filtered-build
for file in $(ls release); do
if [[ $file == latest.yml || $file == RedArchive-Windows* ]]; then
mv release/$file filtered-build/
fi
done
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: windows-build-artifacts
path: filtered-build/
retention-days: 1
buildMac:
name: BuildMac
runs-on: macos-latest
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm install
- name: Build and package
run: npm run build
- name: Filter Build Artifacts
shell: bash
run: |
mkdir -p filtered-build
for file in $(ls release); do
if [[ $file == latest*.yml || $file == RedArchive-Mac* ]]; then
mv release/$file filtered-build/
fi
done
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: mac-build-artifacts
path: filtered-build/
retention-days: 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment