Update release.yml #53
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
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: test | |
on: | |
push: | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
tzutil /s "China Standard Time" | |
python -m pip install --upgrade pip | |
pip install flake8 | |
pip install -r requirements.txt | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: build | |
run: | | |
pip install pyinstaller | |
pyinstaller -F xapkInstaller.py -i NONE | |
copy dist\xapkInstaller.exe xapkInstaller.exe | |
- name: changelog | |
shell: python | |
run: | | |
# -*- coding: utf-8 -*- | |
import re | |
with open('CHANGELOG.txt', 'r', encoding='utf8') as f: | |
data = f.read() | |
list1 = re.split('\d+\.\d+\.\d+.*', data) | |
with open('Release-CHANGELOG.txt', 'w+', encoding='utf8') as f: | |
f.write(list1[1].strip()) | |
import os | |
import time | |
env_file = os.getenv('GITHUB_ENV') | |
with open(env_file, "a") as f: | |
f.write("xapkInstaller={}".format(time.strftime('0.%y.%m%d%H'))) | |
- name: print changelog | |
run: | | |
chcp 65001 | |
type Release-CHANGELOG.txt | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.xapkInstaller }} | |
path: xapkInstaller.exe | |