2024-08-31 12:45:33 -07:00

102 lines
2.8 KiB
YAML

name: Build-and-deploy
on:
pull_request:
types:
- closed
branches:
- main
jobs:
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
with:
json: "true"
files_from_source_file: .change-monitored
- name: List all changed files and save to env
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 and will be added to updater"
done
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install PyYAML
- name: Run release_script.py
env:
FTP_SERVER: ${{ secrets.FTP_SERVER }}
FTP_USERNAME: ${{ secrets.FTP_USERNAME }}
FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }}
run: |
python release_script.py
- name: FTP-Deploy-Action
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