-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Use Workflow to automatically post PreRelease
- Loading branch information
Showing
2 changed files
with
72 additions
and
1 deletion.
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,70 @@ | ||
name: Compile executable file | ||
|
||
on: | ||
push: | ||
branches: [ dev ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
- name: Install Dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install requests | ||
- name: Get the latest release tag and increment | ||
id: get_version | ||
run: | | ||
python -c " | ||
import requests | ||
response = requests.get('https://api.github.com/repos/liuyunfz/chaoxing_tool/releases/latest') | ||
latest_tag = response.json()['tag_name'][1:] | ||
version_parts = list(map(int, latest_tag.split('.'))) | ||
if len(version_parts) == 2: | ||
version_parts.append(1) | ||
elif len(version_parts) == 3: | ||
version_parts[2] += 1 | ||
new_tag = '.'.join(map(str, version_parts)) | ||
print(f'::set-output name=VERSION::{new_tag}') | ||
" | ||
- name: Use docker to compile | ||
run: | | ||
docker run -v $GITHUB_WORKSPACE:/src cdrx/pyinstaller-windows:latest 'pyinstaller -D --clean -y --distpath ./ --workpath /tmp ./main.py' | ||
- name: Fix permissions | ||
run: | | ||
sudo chmod -R 777 ${{ github.workspace }} | ||
- name: Move some necessary files | ||
run: | | ||
mv ${{ github.workspace }}/functions ${{ github.workspace }}/main/ | ||
mv ${{ github.workspace }}/classis ${{ github.workspace }}/main/ | ||
mv ${{ github.workspace }}/config.yml ${{ github.workspace }}/main/ | ||
- name: Zip the directory | ||
run: | | ||
cd ${{ github.workspace }} | ||
zip -r chaoxing_tool.zip main | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.UPLOAD_TOKEN }} | ||
with: | ||
tag_name: v${{ steps.get_version.outputs.VERSION }} | ||
release_name: ${{ steps.get_version.outputs.VERSION }} Beta Release | ||
draft: false | ||
prerelease: true | ||
- name: Upload Release Asset | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.UPLOAD_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ${{ github.workspace }}/chaoxing_tool.zip | ||
asset_name: chaoxing_tool.zip | ||
asset_content_type: application/zip |
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 |
---|---|---|
|
@@ -2,4 +2,5 @@ loguru >= 0.6.0 | |
pyDes >= 2.0.1 | ||
requests >= 2.27.1 | ||
lxml | ||
PyYAML | ||
PyYAML | ||
pyinstaller>=5.13.2 |