From 6f6d120dcb253f1ff9ee84a80edd12921f32acc3 Mon Sep 17 00:00:00 2001 From: Philipp Micke Date: Sat, 28 Dec 2024 20:32:17 +0100 Subject: [PATCH 1/5] ci: use a matrix strategy for cleaner builds --- .github/workflows/build.yml | 732 +++++------------------------------- 1 file changed, 100 insertions(+), 632 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 12efe44247..5793e3d553 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,372 +13,87 @@ permissions: contents: write jobs: - build_ubuntu_20_04: - runs-on: ubuntu-20.04 - if: ${{ !startsWith(github.ref, 'ref/heads/release') }} - env: - gpg_private_key: ${{ secrets.PACKAGESIGNKEY }} - gpg_private_key_passphrase: ${{ secrets.PACKAGESIGNKEYPASSPHRASE }} - update_api_push_token: ${{ secrets.UPDATE_API_DEPLOY_KEY }} - steps: - - uses: actions/checkout@v4 - - name: Install poetry - uses: abatilo/actions-poetry@v2 - with: - poetry-version: 1.4.1 - - name: Setup Python 3.11 x64 - uses: actions/setup-python@v5 - with: - python-version: "3.11" - architecture: "x64" - cache: "poetry" - - name: Install build dependencies - run: | - sudo apt-get update - sudo apt-get install -y build-essential zlib1g-dev - - name: install dependencies - run: poetry install --with build -E discord - - name: Build PyInstaller bootloader - run: | - git clone https://github.com/pyinstaller/pyinstaller.git - cd pyinstaller - git checkout v6.11.0 - cd bootloader - python ./waf all - cd ../../ - poetry run pip install -e pyinstaller - - name: Configure dev - if: ${{ !startsWith(github.ref, 'refs/tags/') }} - run: | - echo "VERSION_NUMBER=${{ github.sha }}" >> $GITHUB_ENV - echo "RELEASE_CHANNEL=${{ vars.DEVELOPMENT_RELEASE_CHANNEL }}" >> $GITHUB_ENV - - name: Configure release - if: startsWith(github.ref, 'refs/tags/') - run: | - echo "VERSION_NUMBER=${{ github.ref_name }}" >> $GITHUB_ENV - echo "RELEASE_CHANNEL=${{ vars.STABLE_RELEASE_CHANNEL }}" >> $GITHUB_ENV - - name: Write version file - run: | - echo "[DEFAULT]" > version.ini - echo "version_number=${{ env.VERSION_NUMBER }}" >> version.ini - echo "release_channel=${{ env.RELEASE_CHANNEL }}" >> version.ini - echo "upstream=${{ github.repository }}" >> version.ini - # This only runs on development builds, please write release commits manually - - name: Write commit file - if: ${{ !startsWith(github.ref, 'refs/tags/') }} - run: | - git log --pretty="format:%H|||%cd|||%b|||%s" -15 --no-decorate --merges --grep="Merge pull request" --date=short > changelog.txt - - name: Run PyInstaller - if: ${{ !startsWith(github.ref, 'refs/tags/') }} - run: poetry run python3 -m PyInstaller Clangen.spec - env: - IS_RELEASE: 0 - - name: Run PyInstaller - if: ${{ startsWith(github.ref, 'refs/tags/') }} - run: poetry run python3 -m PyInstaller Clangen.spec - env: - IS_RELEASE: 1 - - name: Create archive (.tar.xz) - run: tar -caf Clangen_Linux64_glibc2.31+.tar.xz -C dist Clangen - - uses: actions/upload-artifact@v4 - with: - name: Clangen_Linux64_glibc2.31+.tar.xz - path: Clangen_Linux64_glibc2.31+.tar.xz - - name: Import GPG key - id: import_gpg - uses: crazy-max/ghaction-import-gpg@v5 - if: ${{ env.gpg_private_key != '' && env.gpg_private_key_passphrase != '' }} - with: - gpg_private_key: ${{ secrets.PACKAGESIGNKEY }} - passphrase: ${{ secrets.PACKAGESIGNKEYPASSPHRASE }} - - name: Upload artifact to API - if: ${{ env.update_api_push_token != '' && (github.ref == 'refs/heads/development' || startsWith(github.ref, 'refs/tags/')) }} - run: | - gpg --output Clangen_Linux64_glibc2.31+.tar.xz.sig --detach-sig -a Clangen_Linux64_glibc2.31+.tar.xz - curl -X 'POST' \ - 'https://clangen.io/api/v1/Update/Channels/${{ env.RELEASE_CHANNEL }}/Releases/${{ env.VERSION_NUMBER }}/Appoint' \ - -H 'X-API-Key: ${{ secrets.UPDATE_API_DEPLOY_KEY }}' \ - -H 'accept: */*' - curl -X 'PUT' \ - 'https://clangen.io/api/v1/Update/Channels/${{ env.RELEASE_CHANNEL }}/Releases/${{ env.VERSION_NUMBER }}/Artifacts/linux2.31' \ - -H 'X-API-Key: ${{ secrets.UPDATE_API_DEPLOY_KEY }}' \ - -H 'accept: */*' \ - -H 'Content-Type: multipart/form-data' \ - -F 'fileBundle=@Clangen_Linux64_glibc2.31+.tar.xz' \ - -F 'fileBundle=@Clangen_Linux64_glibc2.31+.tar.xz.sig' \ - --http1.1 - - name: Set up butler - uses: thlumyn/setup-butler@clangen - - name: Upload build to itch.io - env: - BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }} - if: startsWith(github.ref, 'refs/tags/') && env.BUTLER_API_KEY != '' - run: butler push Clangen_Linux64_glibc2.31+.tar.xz sablesteel/clan-gen-fan-edit:linux64_glibc_231 --userversion "${{ env.VERSION_NUMBER }}" - - name: Release - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') - with: - files: Clangen_Linux64_glibc2.31+.tar.xz - - build_ubuntu_22_04: - runs-on: ubuntu-22.04 + build: + strategy: + matrix: + include: + - os: ubuntu-20.04 + artifact_name: Clangen_Linux64_glibc2.31+.tar.xz + python_version: "3.11" + python_arch: "x64" + itch_channel: linux64_glibc_231 + api_artifact_name: linux2.31 + + - os: ubuntu-22.04 + artifact_name: Clangen_Linux64_glibc2.35+.tar.xz + python_version: "3.11" + python_arch: "x64" + itch_channel: linux64_glibc_235 + api_artifact_name: linux2.35 + + - os: windows-2019 + artifact_name: Clangen_Win32.zip + python_version: "3.8" + python_arch: "x86" + itch_channel: win32 + api_artifact_name: win32 + + - os: windows-latest + artifact_name: Clangen_Win64.zip + python_version: "3.8" + python_arch: "x64" + itch_channel: win64 + api_artifact_name: win64 + + - os: windows-latest + artifact_name: Clangen_Win64_Windows10+.zip + python_version: "3.11" + python_arch: "x64" + itch_channel: win64_10 + api_artifact_name: win10+ + + - os: macos-13 + artifact_name: Clangen_macOS64.dmg + python_version: "3.11" + python_arch: "x64" + itch_channel: osx64 + api_artifact_name: macOS + + runs-on: ${{ matrix.os }} if: ${{ !startsWith(github.ref, 'ref/heads/release') }} env: gpg_private_key: ${{ secrets.PACKAGESIGNKEY }} gpg_private_key_passphrase: ${{ secrets.PACKAGESIGNKEYPASSPHRASE }} update_api_push_token: ${{ secrets.UPDATE_API_DEPLOY_KEY }} + defaults: + run: + shell: bash -l {0} steps: - uses: actions/checkout@v4 - name: Install poetry uses: abatilo/actions-poetry@v2 with: poetry-version: 1.4.1 - - name: Setup Python 3.11 x64 + - name: Setup Python uses: actions/setup-python@v5 with: - python-version: "3.11" - architecture: "x64" + python-version: ${{ matrix.python_version }} + architecture: ${{ matrix.python_arch }} cache: "poetry" - - name: Install build dependencies + - name: Install build dependencies (Ubuntu) + if: startsWith(matrix.os, 'ubuntu') run: | sudo apt-get update sudo apt-get install -y build-essential zlib1g-dev - - name: install dependencies - run: poetry install --with build -E discord - - name: Build PyInstaller bootloader - run: | - git clone https://github.com/pyinstaller/pyinstaller.git - cd pyinstaller - git checkout v6.11.0 - cd bootloader - python ./waf all - cd ../../ - poetry run pip install -e pyinstaller - - name: Configure dev - if: ${{ !startsWith(github.ref, 'refs/tags/') }} - run: | - echo "VERSION_NUMBER=${{ github.sha }}" >> $GITHUB_ENV - echo "RELEASE_CHANNEL=${{ vars.DEVELOPMENT_RELEASE_CHANNEL }}" >> $GITHUB_ENV - - name: Configure release - if: startsWith(github.ref, 'refs/tags/') - run: | - echo "VERSION_NUMBER=${{ github.ref_name }}" >> $GITHUB_ENV - echo "RELEASE_CHANNEL=${{ vars.STABLE_RELEASE_CHANNEL }}" >> $GITHUB_ENV - - name: Write version file - run: | - echo "[DEFAULT]" > version.ini - echo "version_number=${{ env.VERSION_NUMBER }}" >> version.ini - echo "release_channel=${{ env.RELEASE_CHANNEL }}" >> version.ini - echo "upstream=${{ github.repository }}" >> version.ini - # This only runs on development builds, please write release commits manually - - name: Write commit file - if: ${{ !startsWith(github.ref, 'refs/tags/') }} + - name: Install build dependencies (macOS) + if: startsWith(matrix.os, 'macos') run: | - git log --pretty=oneline -15 --no-decorate --no-merges > changelog.txt - - name: Run PyInstaller - if: ${{ !startsWith(github.ref, 'refs/tags/') }} - run: poetry run python3 -m PyInstaller Clangen.spec - env: - IS_RELEASE: 0 - - name: Run PyInstaller - if: ${{ startsWith(github.ref, 'refs/tags/') }} - run: poetry run python3 -m PyInstaller Clangen.spec - env: - IS_RELEASE: 1 - - name: Create archive (.tar.xz) - run: tar -caf Clangen_Linux64_glibc2.35+.tar.xz -C dist Clangen - - uses: actions/upload-artifact@v4 - with: - name: Clangen_Linux64_glibc2.35+.tar.xz - path: Clangen_Linux64_glibc2.35+.tar.xz - - name: Import GPG key - id: import_gpg - uses: crazy-max/ghaction-import-gpg@v5 - if: ${{ env.gpg_private_key != '' && env.gpg_private_key_passphrase != '' }} - with: - gpg_private_key: ${{ secrets.PACKAGESIGNKEY }} - passphrase: ${{ secrets.PACKAGESIGNKEYPASSPHRASE }} - - name: Upload artifact to API - if: ${{ env.update_api_push_token != '' && (github.ref == 'refs/heads/development' || startsWith(github.ref, 'refs/tags/')) }} - run: | - gpg --output Clangen_Linux64_glibc2.35+.tar.xz.sig --detach-sig -a Clangen_Linux64_glibc2.35+.tar.xz - curl -X 'POST' \ - 'https://clangen.io/api/v1/Update/Channels/${{ env.RELEASE_CHANNEL }}/Releases/${{ env.VERSION_NUMBER }}/Appoint' \ - -H 'X-API-Key: ${{ secrets.UPDATE_API_DEPLOY_KEY }}' \ - -H 'accept: */*' - curl -X 'PUT' \ - 'https://clangen.io/api/v1/Update/Channels/${{ env.RELEASE_CHANNEL }}/Releases/${{ env.VERSION_NUMBER }}/Artifacts/linux2.35' \ - -H 'X-API-Key: ${{ secrets.UPDATE_API_DEPLOY_KEY }}' \ - -H 'accept: */*' \ - -H 'Content-Type: multipart/form-data' \ - -F 'fileBundle=@Clangen_Linux64_glibc2.35+.tar.xz' \ - -F 'fileBundle=@Clangen_Linux64_glibc2.35+.tar.xz.sig' \ - --http1.1 - - name: Set up butler - uses: thlumyn/setup-butler@clangen - - name: Upload build to itch.io - env: - BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }} - if: startsWith(github.ref, 'refs/tags/') && env.BUTLER_API_KEY != '' - run: butler push Clangen_Linux64_glibc2.35+.tar.xz sablesteel/clan-gen-fan-edit:linux64_glibc_235 --userversion "${{ env.VERSION_NUMBER }}" - - name: Release - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') - with: - files: Clangen_Linux64_glibc2.35+.tar.xz - - build_win32: - runs-on: windows-2019 - if: ${{ !startsWith(github.ref, 'ref/heads/release') }} - env: - gpg_private_key: ${{ secrets.PACKAGESIGNKEY }} - gpg_private_key_passphrase: ${{ secrets.PACKAGESIGNKEYPASSPHRASE }} - update_api_push_token: ${{ secrets.UPDATE_API_DEPLOY_KEY }} - steps: - - uses: actions/checkout@v4 - - name: Setup Python 3.8 x86 - uses: actions/setup-python@v5 - with: - python-version: "3.8" # 3.8 to support older versions of Windows - architecture: "x86" - - name: Install poetry - uses: abatilo/actions-poetry@v3 - with: - poetry-version: 1.4.1 - - name: Install Visual Studio Build Tools - uses: microsoft/setup-msbuild@v1.1 - - name: Set up cargo cache - uses: actions/cache@v4 - continue-on-error: false - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo- - - name: install dependencies - run: poetry install --with build -E discord - - name: Build PyInstaller bootloader - shell: cmd - run: | - git clone https://github.com/pyinstaller/pyinstaller.git - cd pyinstaller - git checkout v6.11.0 - cd bootloader - python ./waf all - cd ../../ - poetry run pip install -e pyinstaller - - name: Configure dev - shell: bash - if: ${{ !startsWith(github.ref, 'refs/tags/') }} - run: | - echo "VERSION_NUMBER=${{ github.sha }}" >> $GITHUB_ENV - echo "RELEASE_CHANNEL=${{ vars.DEVELOPMENT_RELEASE_CHANNEL }}" >> $GITHUB_ENV - - name: Configure release - shell: bash - if: startsWith(github.ref, 'refs/tags/') - run: | - echo "VERSION_NUMBER=${{ github.ref_name }}" >> $GITHUB_ENV - echo "RELEASE_CHANNEL=${{ vars.STABLE_RELEASE_CHANNEL }}" >> $GITHUB_ENV - - name: Write version file - shell: bash - run: | - echo "[DEFAULT]" > version.ini - echo "version_number=${{ env.VERSION_NUMBER }}" >> version.ini - echo "release_channel=${{ env.RELEASE_CHANNEL }}" >> version.ini - echo "upstream=${{ github.repository }}" >> version.ini - # This only runs on development builds, please write release commits manually - - name: Write commit file - shell: bash - if: ${{ !startsWith(github.ref, 'refs/tags/') }} - run: | - git log --pretty="format:%H|||%cd|||%b|||%s" -15 --no-decorate --merges --grep="Merge pull request" --date=short > changelog.txt - - name: Build self-updater binary - shell: bash - run: | - cd self_updater - cargo build --release - cp target/release/self_updater.exe ../resources/ - - name: Run PyInstaller - if: ${{ !startsWith(github.ref, 'refs/tags/') }} - run: poetry run PyInstaller Clangen.spec - env: - IS_RELEASE: 0 - - name: Run PyInstaller - if: ${{ startsWith(github.ref, 'refs/tags/') }} - run: poetry run PyInstaller Clangen.spec - env: - IS_RELEASE: 1 - - name: Create archive (.zip) - run: | - cp dist/Clangen/_internal/.itch.toml dist/ - tar.exe -a -c -f Clangen_Win32.zip -C dist Clangen .itch.toml - - uses: actions/upload-artifact@v4 - with: - name: Clangen_Win32 - path: Clangen_Win32.zip - - name: Import GPG key - id: import_gpg - uses: crazy-max/ghaction-import-gpg@v5 - if: ${{ env.gpg_private_key != '' && env.gpg_private_key_passphrase != '' }} - with: - gpg_private_key: ${{ secrets.PACKAGESIGNKEY }} - passphrase: ${{ secrets.PACKAGESIGNKEYPASSPHRASE }} - - name: Upload artifact to API - if: ${{ env.update_api_push_token != '' && (github.ref == 'refs/heads/development' || startsWith(github.ref, 'refs/tags/')) }} - shell: bash - run: | - gpg --output Clangen_Win32.zip.sig --detach-sig -a Clangen_Win32.zip - curl -X 'POST' \ - 'https://clangen.io/api/v1/Update/Channels/${{ env.RELEASE_CHANNEL }}/Releases/${{ env.VERSION_NUMBER }}/Appoint' \ - -H 'X-API-Key: ${{ secrets.UPDATE_API_DEPLOY_KEY }}' \ - -H 'accept: */*' - curl -X 'PUT' \ - 'https://clangen.io/api/v1/Update/Channels/${{ env.RELEASE_CHANNEL }}/Releases/${{ env.VERSION_NUMBER }}/Artifacts/win32' \ - -H 'X-API-Key: ${{ secrets.UPDATE_API_DEPLOY_KEY }}' \ - -H 'accept: */*' \ - -H 'Content-Type: multipart/form-data' \ - -F 'fileBundle=@Clangen_Win32.zip;type=application/zip' \ - -F 'fileBundle=@Clangen_Win32.zip.sig' \ - --http1.1 - - name: Set up butler - uses: thlumyn/setup-butler@clangen - - name: Upload build to itch.io - if: startsWith(github.ref, 'refs/tags/') && env.BUTLER_API_KEY != '' - env: - BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }} - run: butler push Clangen_Win32.zip sablesteel/clan-gen-fan-edit:win32 --userversion "${{ env.VERSION_NUMBER }}" - - name: Release - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') - with: - files: Clangen_Win32.zip - - build_win64: - runs-on: windows-latest - if: ${{ !startsWith(github.ref, 'ref/heads/release') }} - env: - gpg_private_key: ${{ secrets.PACKAGESIGNKEY }} - gpg_private_key_passphrase: ${{ secrets.PACKAGESIGNKEYPASSPHRASE }} - update_api_push_token: ${{ secrets.UPDATE_API_DEPLOY_KEY }} - steps: - - uses: actions/checkout@v4 - - name: Install poetry - uses: abatilo/actions-poetry@v3 - with: - poetry-version: 1.4.1 - - name: Setup Python 3.8 x64 - uses: actions/setup-python@v5 - with: - python-version: "3.8" # 3.8 to support older versions of Windows - architecture: "x64" - cache: "poetry" - - name: Install Visual Studio Build Tools + brew install zlib + - name: Install Visual Studio Build Tools (Windows) + if: startsWith(matrix.os, 'windows') uses: microsoft/setup-msbuild@v1.1 - - name: Set up cargo cache + - name: Set up cargo cache (Windows) + if: startsWith(matrix.os, 'windows') uses: actions/cache@v4 continue-on-error: false with: @@ -393,7 +108,6 @@ jobs: - name: install dependencies run: poetry install --with build -E discord - name: Build PyInstaller bootloader - shell: cmd run: | git clone https://github.com/pyinstaller/pyinstaller.git cd pyinstaller @@ -403,195 +117,59 @@ jobs: cd ../../ poetry run pip install -e pyinstaller - name: Configure dev - shell: bash if: ${{ !startsWith(github.ref, 'refs/tags/') }} run: | echo "VERSION_NUMBER=${{ github.sha }}" >> $GITHUB_ENV echo "RELEASE_CHANNEL=${{ vars.DEVELOPMENT_RELEASE_CHANNEL }}" >> $GITHUB_ENV - name: Configure release - shell: bash if: startsWith(github.ref, 'refs/tags/') run: | echo "VERSION_NUMBER=${{ github.ref_name }}" >> $GITHUB_ENV echo "RELEASE_CHANNEL=${{ vars.STABLE_RELEASE_CHANNEL }}" >> $GITHUB_ENV - name: Write version file - shell: bash run: | echo "[DEFAULT]" > version.ini echo "version_number=${{ env.VERSION_NUMBER }}" >> version.ini echo "release_channel=${{ env.RELEASE_CHANNEL }}" >> version.ini echo "upstream=${{ github.repository }}" >> version.ini - # This only runs on development builds, please write release commits manually - name: Write commit file - shell: bash if: ${{ !startsWith(github.ref, 'refs/tags/') }} run: | git log --pretty="format:%H|||%cd|||%b|||%s" -15 --no-decorate --merges --grep="Merge pull request" --date=short > changelog.txt - # Example of an upx install, also requires adding "--upx-dir upx-4.0.0-win64" to the pyinst run - #- name: Setup UPX - # run: | - # curl -L -O https://github.com/upx/upx/releases/download/v4.0.0/upx-4.0.0-win64.zip - # tar.exe -x -v -f upx-4.0.0-win64.zip - - name: Build self-updater binary - shell: bash + - name: Build self-updater binary (Windows) + if: startsWith(matrix.os, 'windows') run: | cd self_updater cargo build --release cp target/release/self_updater.exe ../resources/ - - name: Run PyInstaller + - name: Run PyInstaller (Development) if: ${{ !startsWith(github.ref, 'refs/tags/') }} - run: poetry run PyInstaller Clangen.spec + run: poetry run python -m PyInstaller Clangen.spec env: IS_RELEASE: 0 - - name: Run PyInstaller + - name: Run PyInstaller (Release) if: ${{ startsWith(github.ref, 'refs/tags/') }} - run: poetry run PyInstaller Clangen.spec + run: poetry run python -m PyInstaller Clangen.spec env: IS_RELEASE: 1 - - name: Create archive (.zip) + - name: Create archive (Linux) + if: startsWith(matrix.os, 'ubuntu') + run: tar -caf ${{ matrix.artifact_name }} -C dist Clangen + - name: Create archive (Windows) + if: startsWith(matrix.os, 'windows') run: | cp dist/Clangen/_internal/.itch.toml dist/ - tar.exe -a -c -f Clangen_Win64.zip -C dist Clangen .itch.toml - - uses: actions/upload-artifact@v4 - with: - name: Clangen_Win64 - path: Clangen_Win64.zip - - name: Import GPG key - id: import_gpg - uses: crazy-max/ghaction-import-gpg@v5 - if: ${{ env.gpg_private_key != '' && env.gpg_private_key_passphrase != '' }} - with: - gpg_private_key: ${{ secrets.PACKAGESIGNKEY }} - passphrase: ${{ secrets.PACKAGESIGNKEYPASSPHRASE }} - - name: Upload artifact to API - if: ${{ env.update_api_push_token != '' && (github.ref == 'refs/heads/development' || startsWith(github.ref, 'refs/tags/')) }} - shell: bash + tar.exe -a -c -f ${{ matrix.artifact_name }} -C dist Clangen .itch.toml + - name: Create DMG (macOS) + if: startsWith(matrix.os, 'macos') run: | - gpg --output Clangen_Win64.zip.sig --detach-sig -a Clangen_Win64.zip - curl -X 'POST' \ - 'https://clangen.io/api/v1/Update/Channels/${{ env.RELEASE_CHANNEL }}/Releases/${{ env.VERSION_NUMBER }}/Appoint' \ - -H 'X-API-Key: ${{ secrets.UPDATE_API_DEPLOY_KEY }}' \ - -H 'accept: */*' - curl -X 'PUT' \ - 'https://clangen.io/api/v1/Update/Channels/${{ env.RELEASE_CHANNEL }}/Releases/${{ env.VERSION_NUMBER }}/Artifacts/win64' \ - -H 'X-API-Key: ${{ secrets.UPDATE_API_DEPLOY_KEY }}' \ - -H 'accept: */*' \ - -H 'Content-Type: multipart/form-data' \ - -F 'fileBundle=@Clangen_Win64.zip;type=application/zip' \ - -F 'fileBundle=@Clangen_Win64.zip.sig' \ - --http1.1 - - name: Set up butler - uses: thlumyn/setup-butler@clangen - - name: Upload build to itch.io - env: - BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }} - if: startsWith(github.ref, 'refs/tags/') && env.BUTLER_API_KEY != '' - run: butler push Clangen_Win64.zip sablesteel/clan-gen-fan-edit:win64 --userversion "${{ env.VERSION_NUMBER }}" - - name: Release - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') - with: - files: Clangen_Win64.zip - - build_win64_py311: - runs-on: windows-latest - if: ${{ !startsWith(github.ref, 'ref/heads/release') }} - env: - gpg_private_key: ${{ secrets.PACKAGESIGNKEY }} - gpg_private_key_passphrase: ${{ secrets.PACKAGESIGNKEYPASSPHRASE }} - update_api_push_token: ${{ secrets.UPDATE_API_DEPLOY_KEY }} - steps: - - uses: actions/checkout@v4 - - name: Install poetry - uses: abatilo/actions-poetry@v2 - with: - poetry-version: 1.4.1 - - name: Setup Python 3.11 x64 - uses: actions/setup-python@v5 - with: - python-version: "3.11" - architecture: "x64" - cache: "poetry" - - name: Install Visual Studio Build Tools - uses: microsoft/setup-msbuild@v1.1 - - name: Set up cargo cache - uses: actions/cache@v4 - continue-on-error: false - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo- - - name: install dependencies - run: poetry install --with build -E discord - - name: Build PyInstaller bootloader - shell: cmd - run: | - git clone https://github.com/pyinstaller/pyinstaller.git - cd pyinstaller - git checkout v6.11.0 - cd bootloader - python ./waf all - cd ../../ - poetry run pip install -e pyinstaller - - name: Configure dev - shell: bash - if: ${{ !startsWith(github.ref, 'refs/tags/') }} - run: | - echo "VERSION_NUMBER=${{ github.sha }}" >> $GITHUB_ENV - echo "RELEASE_CHANNEL=${{ vars.DEVELOPMENT_RELEASE_CHANNEL }}" >> $GITHUB_ENV - - name: Configure release - shell: bash - if: startsWith(github.ref, 'refs/tags/') - run: | - echo "VERSION_NUMBER=${{ github.ref_name }}" >> $GITHUB_ENV - echo "RELEASE_CHANNEL=${{ vars.STABLE_RELEASE_CHANNEL }}" >> $GITHUB_ENV - - name: Write version file - shell: bash - run: | - echo "[DEFAULT]" > version.ini - echo "version_number=${{ env.VERSION_NUMBER }}" >> version.ini - echo "release_channel=${{ env.RELEASE_CHANNEL }}" >> version.ini - echo "upstream=${{ github.repository }}" >> version.ini - # This only runs on development builds, please write release commits manually - - name: Write commit file - shell: bash - if: ${{ !startsWith(github.ref, 'refs/tags/') }} - run: | - git log --pretty="format:%H|||%cd|||%b|||%s" -15 --no-decorate --merges --grep="Merge pull request" --date=short > changelog.txt - # Example of an upx install, also requires adding "--upx-dir upx-4.0.0-win64" to the pyinst run - #- name: Setup UPX - # run: | - # curl -L -O https://github.com/upx/upx/releases/download/v4.0.0/upx-4.0.0-win64.zip - # tar.exe -x -v -f upx-4.0.0-win64.zip - - name: Build self-updater binary - shell: bash - run: | - cd self_updater - cargo build --release - cp target/release/self_updater.exe ../resources/ - - name: Run PyInstaller - if: ${{ !startsWith(github.ref, 'refs/tags/') }} - run: poetry run PyInstaller Clangen.spec - env: - IS_RELEASE: 0 - - name: Run PyInstaller - if: ${{ startsWith(github.ref, 'refs/tags/') }} - run: poetry run PyInstaller Clangen.spec - env: - IS_RELEASE: 1 - - name: Create archive (.zip) - run: | - cp dist/Clangen/_internal/.itch.toml dist/ - tar.exe -a -c -f Clangen_Win64_Windows10+.zip -C dist Clangen .itch.toml + rm -r dist/Clangen + npm install -g appdmg + appdmg appdmg.json ${{ matrix.artifact_name }} - uses: actions/upload-artifact@v4 with: - name: Clangen_Win64_Windows10+ - path: Clangen_Win64_Windows10+.zip + name: ${{ matrix.artifact_name }} + path: ${{ matrix.artifact_name }} - name: Import GPG key id: import_gpg uses: crazy-max/ghaction-import-gpg@v5 @@ -601,20 +179,26 @@ jobs: passphrase: ${{ secrets.PACKAGESIGNKEYPASSPHRASE }} - name: Upload artifact to API if: ${{ env.update_api_push_token != '' && (github.ref == 'refs/heads/development' || startsWith(github.ref, 'refs/tags/')) }} - shell: bash run: | - gpg --output Clangen_Win64_Windows10+.zip.sig --detach-sig -a Clangen_Win64_Windows10+.zip + if [[ "${{ matrix.os }}" == "macos-13" ]]; then + zip ${{ matrix.artifact_name }}.zip ./${{ matrix.artifact_name }} + gpg --output ${{ matrix.artifact_name }}.zip.sig --detach-sig -a ${{ matrix.artifact_name }}.zip + BUNDLE_NAME="${{ matrix.artifact_name }}.zip" + else + gpg --output ${{ matrix.artifact_name }}.sig --detach-sig -a ${{ matrix.artifact_name }} + BUNDLE_NAME="${{ matrix.artifact_name }}" + fi curl -X 'POST' \ 'https://clangen.io/api/v1/Update/Channels/${{ env.RELEASE_CHANNEL }}/Releases/${{ env.VERSION_NUMBER }}/Appoint' \ -H 'X-API-Key: ${{ secrets.UPDATE_API_DEPLOY_KEY }}' \ -H 'accept: */*' curl -X 'PUT' \ - 'https://clangen.io/api/v1/Update/Channels/${{ env.RELEASE_CHANNEL }}/Releases/${{ env.VERSION_NUMBER }}/Artifacts/win10+' \ + 'https://clangen.io/api/v1/Update/Channels/${{ env.RELEASE_CHANNEL }}/Releases/${{ env.VERSION_NUMBER }}/Artifacts/${{ matrix.api_artifact_name }}' \ -H 'X-API-Key: ${{ secrets.UPDATE_API_DEPLOY_KEY }}' \ -H 'accept: */*' \ -H 'Content-Type: multipart/form-data' \ - -F 'fileBundle=@Clangen_Win64_Windows10+.zip;type=application/zip' \ - -F 'fileBundle=@Clangen_Win64_Windows10+.zip.sig' \ + -F "fileBundle=@${BUNDLE_NAME}" \ + -F "fileBundle=@${BUNDLE_NAME}.sig" \ --http1.1 - name: Set up butler uses: thlumyn/setup-butler@clangen @@ -622,138 +206,22 @@ jobs: env: BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }} if: startsWith(github.ref, 'refs/tags/') && env.BUTLER_API_KEY != '' - run: butler push Clangen_Win64_Windows10+.zip sablesteel/clan-gen-fan-edit:win64_10 --userversion "${{ env.VERSION_NUMBER }}" - - name: Release - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') - with: - files: Clangen_Win64_Windows10+.zip - - build_macos64: - # For commits to the original mac build action see: - # https://github.com/ClanGenOfficial/clangen/blob/29c9e39fed9a09b8de906f5c3b91dc044fe9b9a5/.github/workflows/main.yml - runs-on: macos-13 - if: ${{ !startsWith(github.ref, 'ref/heads/release') }} - env: - gpg_private_key: ${{ secrets.PACKAGESIGNKEY }} - gpg_private_key_passphrase: ${{ secrets.PACKAGESIGNKEYPASSPHRASE }} - update_api_push_token: ${{ secrets.UPDATE_API_DEPLOY_KEY }} - defaults: - run: - shell: bash -l {0} - steps: - - uses: actions/checkout@v4 - - name: Install poetry - uses: abatilo/actions-poetry@v3 - with: - poetry-version: 1.7.1 - - name: Setup Python 3.11 - uses: actions/setup-python@v5 - with: - python-version: "3.11" - cache: "poetry" - - name: Install build dependencies - run: | - brew install zlib - - name: install dependencies - run: poetry install --with build -E discord - - name: Build PyInstaller bootloader - run: | - git clone https://github.com/pyinstaller/pyinstaller.git - cd pyinstaller - git checkout v6.11.0 - cd bootloader - python ./waf all - cd ../../ - poetry run pip install -e pyinstaller - - name: Configure dev - if: ${{ !startsWith(github.ref, 'refs/tags/') }} run: | - echo "VERSION_NUMBER=${{ github.sha }}" >> $GITHUB_ENV - echo "RELEASE_CHANNEL=${{ vars.DEVELOPMENT_RELEASE_CHANNEL }}" >> $GITHUB_ENV - - name: Configure release - if: startsWith(github.ref, 'refs/tags/') - run: | - echo "VERSION_NUMBER=${{ github.ref_name }}" >> $GITHUB_ENV - echo "RELEASE_CHANNEL=${{ vars.STABLE_RELEASE_CHANNEL }}" >> $GITHUB_ENV - - name: Write version file - run: | - echo "[DEFAULT]" > version.ini - echo "version_number=${{ env.VERSION_NUMBER }}" >> version.ini - echo "release_channel=${{ env.RELEASE_CHANNEL }}" >> version.ini - echo "upstream=${{ github.repository }}" >> version.ini - # This only runs on development builds, please write release commits manually - - name: Write commit file - if: ${{ !startsWith(github.ref, 'refs/tags/') }} - run: | - git log --pretty="format:%H|||%cd|||%b|||%s" -15 --no-decorate --merges --grep="Merge pull request" --date=short > changelog.txt - - name: Run PyInstaller - if: ${{ !startsWith(github.ref, 'refs/tags/') }} - run: poetry run python -m PyInstaller Clangen.spec - env: - IS_RELEASE: 0 - - name: Run PyInstaller - if: ${{ startsWith(github.ref, 'refs/tags/') }} - run: poetry run python -m PyInstaller Clangen.spec - env: - IS_RELEASE: 1 - - name: Create archive (.tar.xz) - run: rm -r dist/Clangen - - name: Install appdmg - run: "npm install -g appdmg" - - name: Generate .dmg - run: "appdmg appdmg.json Clangen_macOS64.dmg" - - uses: actions/upload-artifact@v4 - with: - name: Clangen_macOS64.dmg - path: Clangen_macOS64.dmg - - name: Import GPG key - id: import_gpg - uses: crazy-max/ghaction-import-gpg@v5 - if: ${{ env.gpg_private_key != '' && env.gpg_private_key_passphrase != '' }} - with: - gpg_private_key: ${{ secrets.PACKAGESIGNKEY }} - passphrase: ${{ secrets.PACKAGESIGNKEYPASSPHRASE }} - - name: Upload artifact to API - if: ${{ env.update_api_push_token != '' && (github.ref == 'refs/heads/development' || startsWith(github.ref, 'refs/tags/')) }} - run: | - zip Clangen_macOS64.dmg.zip ./Clangen_macOS64.dmg - gpg --output Clangen_macOS64.dmg.zip.sig --detach-sig -a Clangen_macOS64.dmg.zip - curl -X 'POST' \ - 'https://clangen.io/api/v1/Update/Channels/${{ env.RELEASE_CHANNEL }}/Releases/${{ env.VERSION_NUMBER }}/Appoint' \ - -H 'X-API-Key: ${{ secrets.UPDATE_API_DEPLOY_KEY }}' \ - -H 'accept: */*' - curl -X 'PUT' \ - 'https://clangen.io/api/v1/Update/Channels/${{ env.RELEASE_CHANNEL }}/Releases/${{ env.VERSION_NUMBER }}/Artifacts/macOS' \ - -H 'X-API-Key: ${{ secrets.UPDATE_API_DEPLOY_KEY }}' \ - -H 'accept: */*' \ - -H 'Content-Type: multipart/form-data' \ - -F 'fileBundle=@Clangen_macOS64.dmg.zip;type=application/zip' \ - -F 'fileBundle=@Clangen_macOS64.dmg.zip.sig' \ - --http1.1 - - name: Set up butler - uses: thlumyn/setup-butler@clangen - - name: Upload build to itch.io - env: - BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }} - if: startsWith(github.ref, 'refs/tags/') && env.BUTLER_API_KEY != '' - run: butler push Clangen_macOS64.dmg sablesteel/clan-gen-fan-edit:osx64 --userversion "${{ env.VERSION_NUMBER }}" + if [[ "${{ matrix.os }}" == "macos-13" ]]; then + butler push ${{ matrix.artifact_name }} sablesteel/clan-gen-fan-edit:${{ matrix.itch_channel }} --userversion "${{ env.VERSION_NUMBER }}" + else + butler push ${{ matrix.artifact_name }} sablesteel/clan-gen-fan-edit:${{ matrix.itch_channel }} --userversion "${{ env.VERSION_NUMBER }}" + fi - name: Release uses: softprops/action-gh-release@v1 if: startsWith(github.ref, 'refs/tags/') with: - files: Clangen_macOS64.dmg + files: ${{ matrix.artifact_name }} - confirm_release_ubuntu_22_04: + confirm_release: runs-on: ubuntu-22.04 if: ${{ vars.USE_UPDATE_API != '' && (github.ref == 'refs/heads/development' || startsWith(github.ref, 'refs/tags/')) }} - needs: - - build_ubuntu_20_04 - - build_ubuntu_22_04 - - build_win32 - - build_win64 - - build_win64_py311 - - build_macos64 + needs: build steps: - name: Configure dev if: ${{ !startsWith(github.ref, 'refs/tags/') }} From 2a2c7fdac2b5e9d6d82437ca0ff8777a31671b39 Mon Sep 17 00:00:00 2001 From: Philipp Micke Date: Sat, 28 Dec 2024 20:41:47 +0100 Subject: [PATCH 2/5] ci: do more caching --- .github/workflows/build.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5793e3d553..27a3539fdc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -80,6 +80,7 @@ jobs: python-version: ${{ matrix.python_version }} architecture: ${{ matrix.python_arch }} cache: "poetry" + cache-dependency-path: poetry.lock - name: Install build dependencies (Ubuntu) if: startsWith(matrix.os, 'ubuntu') run: | @@ -105,9 +106,15 @@ jobs: target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} restore-keys: ${{ runner.os }}-cargo- + - name: Cache PyInstaller bootloader + uses: actions/cache@v4 + with: + path: pyinstaller + key: ${{ runner.os }}-pyinstaller-${{ matrix.python_version }}-v6.11.0 - name: install dependencies run: poetry install --with build -E discord - name: Build PyInstaller bootloader + if: steps.cache-pyinstaller.outputs.cache-hit != 'true' run: | git clone https://github.com/pyinstaller/pyinstaller.git cd pyinstaller @@ -116,6 +123,9 @@ jobs: python ./waf all cd ../../ poetry run pip install -e pyinstaller + - name: Install cached PyInstaller + if: steps.cache-pyinstaller.outputs.cache-hit == 'true' + run: poetry run pip install -e pyinstaller - name: Configure dev if: ${{ !startsWith(github.ref, 'refs/tags/') }} run: | From bc365581c52109e57de9bd419d625309256f0306 Mon Sep 17 00:00:00 2001 From: Philipp Micke Date: Sat, 28 Dec 2024 20:47:48 +0100 Subject: [PATCH 3/5] TEST CHANGE --- main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.py b/main.py index 18b5d3b144..f717d53e06 100755 --- a/main.py +++ b/main.py @@ -26,6 +26,9 @@ from importlib import reload from importlib.util import find_spec +if False: + pass + if not getattr(sys, "frozen", False): requiredModules = [ "ujson", From 2b0ae3c38eec1c83006122c7d6b53f6c6e527c40 Mon Sep 17 00:00:00 2001 From: Philipp Micke Date: Sat, 28 Dec 2024 21:43:29 +0100 Subject: [PATCH 4/5] ci: use alternative approach to identify bootloader existence --- .github/workflows/build.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 27a3539fdc..46cbb7c35c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -107,14 +107,23 @@ jobs: key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} restore-keys: ${{ runner.os }}-cargo- - name: Cache PyInstaller bootloader + id: cache-bootloader uses: actions/cache@v4 with: path: pyinstaller key: ${{ runner.os }}-pyinstaller-${{ matrix.python_version }}-v6.11.0 - name: install dependencies run: poetry install --with build -E discord + - name: Check for cached bootloader + id: check-bootloader + run: | + if [ -d "pyinstaller/bootloader/build" ]; then + echo "bootloader_exists=true" >> $GITHUB_OUTPUT + else + echo "bootloader_exists=false" >> $GITHUB_OUTPUT + fi - name: Build PyInstaller bootloader - if: steps.cache-pyinstaller.outputs.cache-hit != 'true' + if: steps.check-bootloader.outputs.bootloader_exists != 'true' run: | git clone https://github.com/pyinstaller/pyinstaller.git cd pyinstaller @@ -124,7 +133,7 @@ jobs: cd ../../ poetry run pip install -e pyinstaller - name: Install cached PyInstaller - if: steps.cache-pyinstaller.outputs.cache-hit == 'true' + if: steps.check-bootloader.outputs.bootloader_exists == 'true' run: poetry run pip install -e pyinstaller - name: Configure dev if: ${{ !startsWith(github.ref, 'refs/tags/') }} From b12bda5e21665727b57e34b6a31210f8aea662bf Mon Sep 17 00:00:00 2001 From: Philipp Micke Date: Sat, 28 Dec 2024 22:56:04 +0100 Subject: [PATCH 5/5] Revert "TEST CHANGE" This reverts commit bc365581c52109e57de9bd419d625309256f0306. --- main.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/main.py b/main.py index f717d53e06..18b5d3b144 100755 --- a/main.py +++ b/main.py @@ -26,9 +26,6 @@ from importlib import reload from importlib.util import find_spec -if False: - pass - if not getattr(sys, "frozen", False): requiredModules = [ "ujson",