3. Final Release #17
This file contains hidden or 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
| # .github/workflows/release.yml | |
| name: MSX Tile Forge Build & Release | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 2 * * *' | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| ###################################################################### | |
| # JOB 1: DEVELOPMENT BUILDS (On-demand from TKT branches) | |
| ###################################################################### | |
| dev_build: | |
| name: Developer Build | |
| # --- THIS CONDITION IS THE FIX --- | |
| # Runs ONLY when manually triggered AND the branch name starts with TKT_ | |
| if: github.event_name == 'workflow_dispatch' && startsWith(github.ref_name, 'TKT_') | |
| strategy: | |
| matrix: | |
| os: [windows-latest, ubuntu-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Construct Dev Version String | |
| id: versioning | |
| shell: bash | |
| run: | | |
| BRANCH_NAME="${{ github.ref_name }}" | |
| BASE_VERSION=$(echo "$BRANCH_NAME" | grep -oP 'REL_[0-9.]+' | sed 's/REL_//') | |
| TICKET_NUM=$(echo "$BRANCH_NAME" | grep -oP 'TKT_[0-9]+' | sed 's/TKT_//') | |
| BRANCH_BUILD_NUM=$(git rev-list --count HEAD) | |
| GLOBAL_BUILD_NUM="${{ github.run_number }}" | |
| FINAL_VERSION="v${BASE_VERSION}_dev${TICKET_NUM}.${BRANCH_BUILD_NUM}_${GLOBAL_BUILD_NUM}" | |
| echo "VERSION_STRING=${FINAL_VERSION}" >> $GITHUB_OUTPUT | |
| - name: Update Version in Files | |
| shell: bash | |
| run: find . -type f -name "*.py" -exec sed -i "s/<unreleased>/${{ steps.versioning.outputs.VERSION_STRING }}/g" {} + | |
| - name: Build Binary | |
| run: make ${{ runner.os == 'Windows' && 'win' || 'lin' }} | |
| - name: Upload Developer Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dev-build-${{ runner.os }}-${{ steps.versioning.outputs.VERSION_STRING }} | |
| path: dist/* | |
| ###################################################################### | |
| # JOB 2: RELEASE CANDIDATE BUILDS (On-demand from REL branches) | |
| ###################################################################### | |
| build_rc_release: | |
| name: Release Candidate Build | |
| # --- THIS CONDITION IS THE FIX --- | |
| # Runs ONLY when manually triggered AND the branch name starts with REL_ | |
| if: github.event_name == 'workflow_dispatch' && startsWith(github.ref_name, 'REL_') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Placeholder for RC Build | |
| run: echo "RC build for branch ${{ github.ref_name }} would run here." | |
| ###################################################################### | |
| # JOB 3: NIGHTLY BUILDS (Scheduled) | |
| ###################################################################### | |
| nightly_build: | |
| name: Nightly Build | |
| # This job ONLY runs on a schedule (we will add its manual trigger later if needed) | |
| if: github.event_name == 'schedule' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Placeholder for Nightly Build | |
| run: echo "Nightly build would run here." | |
| ###################################################################### | |
| # JOB 4: FINAL RELEASES (from tags) | |
| ###################################################################### | |
| release_build: | |
| name: Release Build | |
| # This job ONLY runs on a push of a tag | |
| if: startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Placeholder for Release Build | |
| run: echo "Release build for tag ${{ github.ref_name }} would run here." |