-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
📦 ci(main.yml): add GitHub Actions workflow for building and releasin…
…g the application The main.yml file contains a GitHub Actions workflow that automates the build and release process for the application. It defines two jobs: "build" and "release". The "build" job builds the application for different operating systems (ubuntu-20.04, windows-latest, macos-latest) using Nuitka and packages the binary into a tar.gz or zip file. The "release" job downloads the artifacts from the "build" job, reorganizes them into a "dist" directory, and creates a draft release on GitHub using the softprops/action-gh-release action. This workflow improves the development process by automating the build and release steps.
- Loading branch information
Showing
1 changed file
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
name: Build and Release | ||
|
||
env: | ||
APP_NAME: BiliBili_Livestream_Reminder | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-20.04, windows-latest, macos-latest] | ||
include: | ||
- os: ubuntu-20.04 | ||
arch: x86_64 | ||
platform: linux | ||
ext: tar.gz | ||
- os: windows-latest | ||
arch: x86_64 | ||
platform: windows | ||
ext: zip | ||
- os: macos-latest | ||
arch: x86_64 | ||
platform: darwin | ||
ext: tar.gz | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Python 3.10 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
cache: 'pip' | ||
cache-dependency-path: '**/requirements*.txt' | ||
|
||
- name: Install Dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Build Executable | ||
uses: Nuitka/Nuitka-Action@main | ||
with: | ||
nuitka-version: main | ||
script-name: main.py | ||
onefile: true | ||
output-file: ${{ env.APP_NAME }} | ||
|
||
- name: Package Binary | ||
shell: bash | ||
run: | | ||
if [ "${{ matrix.os }}" = "windows-latest" ]; then | ||
7z a ${{ env.APP_NAME }}-${{ matrix.arch }}-${{ matrix.platform }}.${{ matrix.ext }} build/${{ env.APP_NAME }}.exe | ||
else | ||
tar -czvf ${{ env.APP_NAME }}-${{ matrix.arch }}-${{ matrix.platform }}.${{ matrix.ext }} -C build ${{ env.APP_NAME }} | ||
fi | ||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ runner.os }} Build | ||
path: ${{ env.APP_NAME }}-${{ matrix.arch }}-${{ matrix.platform }}.${{ matrix.ext }} | ||
|
||
release: | ||
needs: build | ||
|
||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- name: Download Artifacts | ||
uses: actions/download-artifact@v3 | ||
|
||
- name: Reorganize Artifacts | ||
run: | | ||
mkdir -p dist/ | ||
mv */* dist/ | ||
- name: Draft Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
draft: true | ||
files: dist/* | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |