diff --git a/.github/workflows/build-exes.yml b/.github/workflows/build-exes.yml index f87fcc3..55b1cf9 100644 --- a/.github/workflows/build-exes.yml +++ b/.github/workflows/build-exes.yml @@ -3,9 +3,7 @@ name: Build Windows EXEs on: push: branches: - - main - tags: - - 'v*' + - develop pull_request: workflow_dispatch: @@ -87,8 +85,8 @@ jobs: if-no-files-found: error release: - name: Publish Release - if: startsWith(github.ref, 'refs/tags/v') + name: Publish Rolling Release + if: github.ref == 'refs/heads/develop' needs: build-windows-x64 runs-on: ubuntu-latest permissions: @@ -99,14 +97,35 @@ jobs: uses: actions/download-artifact@v4 with: name: fca-exes-windows-x64 + path: dist/windows-x64 - - name: Create Release and upload assets + - name: Remove existing rolling assets + shell: bash + run: | + if gh release view rolling --json assets -q '.assets[].name' > /tmp/rolling_assets.txt; then + cat /tmp/rolling_assets.txt | xargs -r -I {} gh release delete-asset rolling "{}" -y + else + echo "Rolling release not found yet; skipping asset cleanup." + fi + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + + - name: Create or update rolling release and upload assets uses: softprops/action-gh-release@v2 with: - tag_name: ${{ github.ref_name }} - name: Release ${{ github.ref_name }} + tag_name: rolling + name: Rolling Release + target_commitish: ${{ github.sha }} + body: | + Build from ${{ github.sha }} + + ${{ github.event.head_commit.message }} files: dist/windows-x64/* - generate_release_notes: true - allow_updates: true + generate_release_notes: false + overwrite_files: true + prerelease: true + make_latest: true + fail_on_unmatched_files: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/manual-release.yml b/.github/workflows/manual-release.yml new file mode 100644 index 0000000..7a5460a --- /dev/null +++ b/.github/workflows/manual-release.yml @@ -0,0 +1,135 @@ +name: Manual Release + +on: + workflow_dispatch: + inputs: + release_tag: + description: "Release tag (e.g., v1.2.3)" + required: true + type: string + release_name: + description: "Release title" + required: true + type: string + release_notes: + description: "Release notes (optional; leave blank to auto-generate)" + required: false + type: string + prerelease: + description: "Mark this release as a prerelease" + required: true + type: boolean + default: false + +jobs: + test: + name: Test (unittest + pytest) + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Install dependencies + working-directory: python + run: | + python -m pip install --upgrade pip + pip install -r requirements-build.txt + pip install pytest + + - name: Run unit tests + working-directory: python + run: python -m unittest discover -s tests -v + + - name: Run pytest + working-directory: python + run: pytest tests/ -v + + build-windows-x64: + name: Build (windows-x64) + needs: test + runs-on: windows-latest + timeout-minutes: 30 + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Install build dependencies + working-directory: python + run: | + python -m pip install --upgrade pip + python -m pip install -r requirements-build.txt + + - name: Run parity smoke test + working-directory: python + run: | + python -m unittest tests.test_fca_unittest.TestFCAToolParity.test_tool_encode_decode_matches_standalone -v + + - name: Ensure icon file exists + working-directory: python + run: | + if (!(Test-Path small-logo.ico)) { + python build_icon.py --input-file small-logo.png --output-file small-logo.ico + } + + - name: Build executables + working-directory: python + run: | + python -m PyInstaller --clean --noconfirm --onefile --icon small-logo.ico --name fca-encode --distpath ../dist/windows-x64 fca_encode.py + python -m PyInstaller --clean --noconfirm --onefile --icon small-logo.ico --name fca-decode --distpath ../dist/windows-x64 fca_decode.py + python -m PyInstaller --clean --noconfirm --onefile --icon small-logo.ico --name fca-tool --distpath ../dist/windows-x64 fca_tool.py + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: fca-exes-windows-x64 + path: dist/windows-x64 + if-no-files-found: error + + release: + name: Publish Release + needs: build-windows-x64 + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Download windows-x64 artifacts + uses: actions/download-artifact@v4 + with: + name: fca-exes-windows-x64 + path: dist/windows-x64 + + - name: Create release and upload assets + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ inputs.release_tag }} + name: ${{ inputs.release_name }} + target_commitish: ${{ github.sha }} + body: ${{ inputs.release_notes }} + generate_release_notes: ${{ inputs.release_notes == '' }} + files: dist/windows-x64/* + overwrite_files: true + make_latest: true + prerelease: ${{ inputs.prerelease }} + fail_on_unmatched_files: true + # Placeholder for custom changelog input: + # append_body: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}