Skip to content

Commit

Permalink
fix: Use Workflow to automatically post PreRelease
Browse files Browse the repository at this point in the history
  • Loading branch information
liuyunfz committed Jun 22, 2024
1 parent 93ab02f commit 854e9cb
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/executable-compile.yml
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_tag = response.json()[0]['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 batonogov/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/_internal/
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

0 comments on commit 854e9cb

Please sign in to comment.