update workflows to build exe

This commit is contained in:
spencershepard 2024-08-31 12:08:55 -07:00 committed by Spencer Shepard
parent c2d19616ab
commit 63a70806e0
7 changed files with 144 additions and 28 deletions

View File

@ -1,4 +1,4 @@
name: Deploy-to-updater
name: Build-and-deploy
on:
pull_request:
types:
@ -7,16 +7,58 @@ on:
- main
jobs:
deploy:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest # windows-latest | macos-latest
name: Deploy to updater if files changed
build-exe:
runs-on: windows-latest
name: Build the executable
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.
- name: Set up Python 3.10.7
uses: actions/setup-python@v3
with:
python-version: "3.10.7"
- name: Install requirements from requirements.txt
run: |
cd Generator
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build UI resources
run: |
cd Generator
pyuic5 -x MissionGeneratorUI.ui -o MissionGeneratorUI.py
pyrcc5 -o resources.py resources.qrc
- name: Build the executable
run: |
cd Generator
pyinstaller MissionGenerator.spec --clean --log-level=DEBUG
- name: Archive the executable
uses: actions/upload-artifact@v4
with:
name: MissionGenerator
path: Generator/dist/MissionGenerator.exe
if-no-files-found: error
deploy:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
name: Deploy to updater
needs: build-exe
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.
- name: Retrieve the executable
uses: actions/download-artifact@v4
with:
name: MissionGenerator
- name: Get monitored changed files
id: changed-files
uses: tj-actions/changed-files@v35
@ -28,46 +70,32 @@ jobs:
run: |
echo "changed_files=${{ steps.changed-files.outputs.all_changed_files }}" >> $GITHUB_ENV
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "$file was changed"
echo "$file was changed and will be added to updater"
done
- name: Test env vars
run: |
echo "${{env.changed_files}}"
- name: Set up Python 3.10
if: steps.changed-files.outputs.any_changed == 'true'
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
if: steps.changed-files.outputs.any_changed == 'true'
run: |
python -m pip install --upgrade pip
pip install PyYAML
- name: Run release_script.py
if: steps.changed-files.outputs.any_changed == 'true'
env:
FTP_SERVER: ${{ secrets.FTP_SERVER }}
FTP_USERNAME: ${{ secrets.FTP_USERNAME }}
FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }}
run: |
python release_script.py
- name: FTP-Deploy
if: steps.changed-files.outputs.any_changed == 'true'
uses: actions/checkout@v2.1.0
with:
fetch-depth: 2
- name: FTP-Deploy-Action
if: steps.changed-files.outputs.any_changed == 'true'
uses: SamKirkland/FTP-Deploy-Action@4.3.3
with:
server: ${{ secrets.FTP_SERVER }}
username: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
server-dir: Updates/continuous/
dry-run: false

85
.github/workflows/pre-deploy.yml vendored Normal file
View File

@ -0,0 +1,85 @@
name: Pre-deployment build check
on:
pull_request:
types:
- opened
- synchronize
- reopened
- edited
branches:
- main
jobs:
version-increment-check:
runs-on: ubuntu-latest
name: Check if version number was incremented
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Get the version string from the working directory
run: |
cd Generator
VERSION=$(python -c "from version import *; print(version_string)")
echo NEW_VERSION=$VERSION >> $GITHUB_ENV
- name: Get the current version string from main branch
run: |
git fetch origin main
git checkout main
cd Generator
VERSION=$(python -c "from version import *; print(version_string)")
echo CURRENT_VERSION=$VERSION >> $GITHUB_ENV
- name: Install packaging module
run: |
python -m pip install --upgrade pip
pip install packaging
- name: Check if version number was incremented
run: |
python -c "from packaging import version as ver; assert ver.parse('${{env.NEW_VERSION}}') > ver.parse('${{env.CURRENT_VERSION}}'), 'Version number was not incremented'"
build-exe:
needs: version-increment-check
runs-on: windows-latest
name: Build the executable
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.
- name: Set up Python 3.10.7
uses: actions/setup-python@v3
with:
python-version: "3.10.7"
- name: Install requirements from requirements.txt
run: |
cd Generator
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build UI resources
run: |
cd Generator
pyuic5 -x MissionGeneratorUI.ui -o MissionGeneratorUI.py
pyrcc5 -o resources.py resources.qrc
- name: Build the executable
run: |
cd Generator
pyinstaller MissionGenerator.spec --clean --log-level=DEBUG
- name: Archive the executable
uses: actions/upload-artifact@v4
with:
name: MissionGenerator
path: Generator/dist/MissionGenerator.exe
if-no-files-found: error

View File

@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.10"]
steps:
- uses: actions/checkout@v3

3
.gitignore vendored
View File

@ -27,4 +27,5 @@ MissionOutput/
*.env
RotorOps_setup.exe
Generator/resources.py
venv
venv
MissionGenerator.exe

View File

@ -96,6 +96,8 @@ example:
# Building new RotorOps_setup.exe installer package
For a new release, the installer package must be built on your dev machine and attached to the release on GitHub. Installforge does not offer a CLI.
Uses https://installforge.net/
See install-config.ifp and installforge_constants.txt

View File

@ -1,4 +1,4 @@
-e git+https://github.com/spencershepard/dcs@48b32ae917b2a67d9409345a1f5c368e59e5229f#egg=pydcs
git+https://github.com/spencershepard/dcs@48b32ae917b2a67d9409345a1f5c368e59e5229f
packaging==21.3
PyQt5==5.15.9
PyYAML==6.0

Binary file not shown.