自动构建
This commit is contained in:
74
.github/workflows/python-app.yml
vendored
74
.github/workflows/python-app.yml
vendored
@@ -1,11 +1,13 @@
|
|||||||
# This workflow will install Python dependencies, run tests and lint with a single version of Python
|
# 依照 MIT 协议,在此注明:本段代码改写自 BtbN/FFmpeg-Builds
|
||||||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
|
|
||||||
|
|
||||||
name: Python application
|
name: Build AUTO_MAA
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "main" ]
|
branches: [ "main" ]
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
- 'LICENSE'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ "main" ]
|
branches: [ "main" ]
|
||||||
|
|
||||||
@@ -13,10 +15,19 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
pre_check:
|
||||||
|
name: Pre Checks
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Repo Check
|
||||||
|
run: |
|
||||||
|
if [[ "$GITHUB_REPOSITORY" != "DLmaster361/AUTO_MAA" ]]; then
|
||||||
|
echo "When forking this repository to make your own builds, you have to adjust this check."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
|
build_AUTO_MAA:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up Python 3.12
|
- name: Set up Python 3.12
|
||||||
@@ -37,8 +48,53 @@ jobs:
|
|||||||
- name: Built with pyinstaller
|
- name: Built with pyinstaller
|
||||||
run: |
|
run: |
|
||||||
pyinstaller -F --version-file res/info.txt -w --icon=res/AUTO_MAA.ico AUTO_MAA.py
|
pyinstaller -F --version-file res/info.txt -w --icon=res/AUTO_MAA.ico AUTO_MAA.py
|
||||||
|
- name: Extract version number
|
||||||
|
id: extract_version_number
|
||||||
|
run: |
|
||||||
|
python -c "import re; content = open('res/info.txt', 'r').read(); match = re.search(r'StringStruct\\(\'ProductVersion\', \'(.*?)\'\\)', content); if match: version_number = match.group(1); print(f'::set-output name=version_number::{version_number}')"
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: AUTO_MAA
|
name: AUTO_MAA_${{ steps.extract_version_number.outputs.version_number }}
|
||||||
path: ./
|
path: |
|
||||||
|
data/**/*
|
||||||
|
gui/**/*
|
||||||
|
res/**/*
|
||||||
|
AUTO_MAA.py
|
||||||
|
dist/AUTO_MAA.exe
|
||||||
|
requirements.txt
|
||||||
|
README.md
|
||||||
|
LICENSE
|
||||||
|
更新说明.txt
|
||||||
|
publish_release:
|
||||||
|
name: Publish release
|
||||||
|
needs: build_AUTO_MAA
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Extract version number
|
||||||
|
id: extract_version_number
|
||||||
|
run: |
|
||||||
|
python -c "import re; content = open('res/info.txt', 'r').read(); match = re.search(r'StringStruct\\(\'ProductVersion\', \'(.*?)\'\\)', content); if match: version_number = match.group(1); print(f'::set-output name=version_number::{version_number}')"
|
||||||
|
- name: Read release content
|
||||||
|
id: read_release_content
|
||||||
|
run: |
|
||||||
|
python -c "with open('更新说明.txt', 'r') as f: release_content = f.read(); print(f'::set-output name=release_content::{release_content}')"
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
pattern: AUTO_MAA_*
|
||||||
|
merge-multiple: true
|
||||||
|
path: artifacts
|
||||||
|
- name: Create release
|
||||||
|
id: create_release
|
||||||
|
run: |
|
||||||
|
set -xe
|
||||||
|
shopt -s nullglob
|
||||||
|
NAME="${{ steps.extract_version_number.outputs.version_number }}"
|
||||||
|
TAGNAME="${{ steps.extract_version_number.outputs.version_number }}"
|
||||||
|
CONTENT="${{ steps.read_release_content.outputs.release_content }}"
|
||||||
|
gh release create "$TAGNAME" --target "main" --title "$NAME" --description "$CONTENT" --artifact artifacts/*.{zip,tar.xz}
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
|
||||||
Reference in New Issue
Block a user