change: use new docker image where python version > 3.9 #2
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
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 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/ | |
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 |