Skip to content

Merge pull request #386 from smjes3/v3.1.0_250226 #454

Merge pull request #386 from smjes3/v3.1.0_250226

Merge pull request #386 from smjes3/v3.1.0_250226 #454

Workflow file for this run

name: Generate application
on:
workflow_dispatch:
push:
paths:
- '**.py'
permissions:
contents: write
jobs:
build:
name: Build
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: 'false'
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: '3.11.5'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt pyinstaller
- name: Generate program
run: |
pyinstaller -D --distpath .\dist\ -i .\logo.ico --contents-directory libraries --uac-admin -n "Fhoe-Rail" fhoe.py -y
- name: Create batch file
run: |
$batContent = @"
@echo off
.\Fhoe-Rail.exe --debug
"@
$batContent | Out-File -FilePath "自选地图.bat" -Encoding ASCII
- name: Move assets to dist directory
run: |
xcopy /E /I /Y .\map\ .\dist\Fhoe-Rail\map\
xcopy /E /I /Y .\新图注意事项\ .\dist\Fhoe-Rail\新图注意事项\
xcopy /E /I /Y .\picture\ .\dist\Fhoe-Rail\picture\
xcopy /Y .\自选地图.bat .\dist\Fhoe-Rail\
xcopy /Y .\README.md .\dist\Fhoe-Rail\
- name: Upload artifact
if: startsWith(github.ref, 'refs/heads/') || startsWith(github.ref, 'refs/pull/')
uses: actions/upload-artifact@v4
with:
name: Fhoe-Rail
path: .\dist\Fhoe-Rail\
- name: Create zip archive
if: startsWith(github.ref, 'refs/tags/')
run: |
$tag = git describe --tags --abbrev=0
[System.IO.File]::WriteAllText(".\dist\Fhoe-Rail\version.txt", $tag)
powershell Compress-Archive -Path .\dist\Fhoe-Rail\ -DestinationPath .\dist\Fhoe-Rail.zip -Force
- name: Create release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
# name: Fhoe-Rail
files: |
./dist/Fhoe-Rail.zip
# prerelease: true