2025-01-17T0320Z-binaries #40
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: Build | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'Source/**' | |
pull_request: | |
branches: | |
- main | |
paths: | |
- 'Source/**' | |
jobs: | |
build-and-compress: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
fail-fast: false # Allows jobs to fail independently | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Get Version Number | |
id: version_num | |
shell: bash | |
run: | | |
export LC_ALL=en_US.utf8 | |
GIT_COMMIT_ID="${{ github.event.head_commit.id }}" | |
GIT_RELEASE_VERSION=$(grep "(?<=GIT_RELEASE_VERSION = ''').+(?=''')" -Po "./Source/util/const.py") | |
UPDATE_TIME=$(echo ${{ github.event.repository.updated_at }} | sed 's/[:-]//g') | |
echo "tag_name=v${GIT_RELEASE_VERSION}-${UPDATE_TIME}" >> $GITHUB_ENV | |
echo "release_name=${GIT_RELEASE_VERSION}-${GIT_COMMIT_ID}" >> $GITHUB_ENV | |
- name: Set Up Python | |
uses: actions/[email protected] | |
with: | |
python-version: '3.13' | |
- name: Install Dependencies | |
run: | | |
pip install --upgrade pip | |
pip install -r Source/requirements.txt | |
pip install -r Source/requirements.dev.txt | |
pip install requests | |
- name: Build PyInstaller | |
run: | | |
echo "Virtual environment activated. Now running pyinstaller." | |
pyinstaller \ | |
--name "RFD" \ | |
--onefile $GITHUB_WORKSPACE/Source/_main.py \ | |
--paths $GITHUB_WORKSPACE/Source/ \ | |
--workpath $GITHUB_WORKSPACE/PyInstallerWork \ | |
--distpath $GITHUB_WORKSPACE/dist \ | |
--icon $GITHUB_WORKSPACE/Source/Icon.ico \ | |
--specpath $GITHUB_WORKSPACE/PyInstallerWork/Spec \ | |
--add-data "$GITHUB_WORKSPACE/Source/*:Source" \ | |
--hidden-import requests | |
shell: bash | |
- name: Compress Executable (Ubuntu) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
zip -j "dist/RFD-${{ matrix.os }}.zip" "dist/RFD" | |
rm "dist/RFD" | |
- name: Rename Executable (Windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
mv "dist/RFD.exe" "dist/RFD-${{ matrix.os }}.exe" | |
shell: bash | |
- name: Upload Artifact (Windows) | |
if: matrix.os == 'windows-latest' | |
uses: actions/[email protected] | |
with: | |
path: "dist/*" | |
name: "RFD-${{ matrix.os }}" | |
- name: Release with Notes | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: "dist/*" | |
name: ${{ env.release_name }} | |
tag_name: ${{ env.tag_name }} | |
prerelease: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |