Skip to content

自动构建发布

自动构建发布 #19

Workflow file for this run

name: Build And Release
on:
push:
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
# 准备发布的tag
- name: prepare tag
id: prepare_tag
run: |
echo ::set-output name=TAG::$(date +'%Y.%m.%dv1')-${{ runner.os }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.prepare_tag.outputs.TAG }}
release_name: Release ${{ steps.prepare_tag.outputs.TAG }}
draft: false
prerelease: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11.9
- name: Install Pyinstaller
run: |
python -m pip install pyinstaller
- name: Build the executable for decrypt_epub
run: |
pyinstaller --onefile --name decrypt_epub 重构epub并反文件名混淆.py
- name: Build the executable for encrypt_epub
run: |
pyinstaller --onefile --name encrypt_epub 重构epub并加入文件名混淆.py
- name: Build the executable for rebuild_epub
run: |
pyinstaller --onefile --name rebuild_epub 重构epub为规范格式_v2.8.3.py
# 上传到release
- name: Upload Release Asset
id: upload-release-asset-decrypt_epub
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/decrypt_epub${{ endsWith(matrix.os, 'windows-latest') && '.exe' || '' }}
asset_name: ${{ runner.os }}-decrypt_epub
asset_content_type: application/octet-stream
- name: Upload Release Asset
id: upload-release-asset-encrypt_epub
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/encrypt_epub${{ endsWith(matrix.os, 'windows-latest') && '.exe' || '' }}
asset_name: ${{ runner.os }}-encrypt_epub
asset_content_type: application/octet-stream
- name: Upload Release Asset
id: upload-release-asset-rebuild_epub
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/rebuild_epub${{ endsWith(matrix.os, 'windows-latest') && '.exe' || '' }}
asset_name: ${{ runner.os }}-rebuild_epub
asset_content_type: application/octet-stream
# - name: Upload the decrypt_epub executable
# uses: actions/upload-artifact@v4
# with:
# name: ${{ runner.os }}-decrypt_epub
# path: dist/decrypt_epub${{ endsWith(matrix.os, 'windows-latest') && '.exe' || '' }}
# if-no-files-found: warn
# - name: Upload the encrypt_epub executable
# uses: actions/upload-artifact@v4
# with:
# name: ${{ runner.os }}-encrypt_epub
# path: dist/encrypt_epub${{ endsWith(matrix.os, 'windows-latest') && '.exe' || '' }}
# if-no-files-found: warn
# - name: Upload the rebuild_epub executable
# uses: actions/upload-artifact@v4
# with:
# name: ${{ runner.os }}-rebuild_epub
# path: dist/rebuild_epub${{ endsWith(matrix.os, 'windows-latest') && '.exe' || '' }}
# if-no-files-found: warn
# - name: Upload all executables
# uses: actions/upload-artifact@v4
# with:
# name: ${{ runner.os }}-all
# path: dist/*