exclude .hidden #1
Workflow file for this run
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
| name: Build and Release | ||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*.*.*' | ||
| env: | ||
| GODOT_VERSION: 4.5.0 | ||
| GODOT_MONO_VERSION: 4.5.0 | ||
| jobs: | ||
| build: | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - os: ubuntu-latest | ||
| export_name: "OpenChamp_Linux_Server" | ||
| preset: "Linux Server" | ||
| artifact_ext: "" | ||
| - os: windows-latest | ||
| export_name: "OpenChamp_Win_Server.exe" | ||
| preset: "Win Server(x86)" | ||
| artifact_ext: ".exe" | ||
| - os: macos-latest | ||
| export_name: "OpenChamp_MacOS_Server.app" | ||
| preset: "Mac Server (universal)" | ||
| artifact_ext: ".app" | ||
| - os: windows-latest | ||
| export_name: "OpenChamp_Windows_Desktop.exe" | ||
| preset: "Windows Desktop" | ||
| artifact_ext: ".exe" | ||
| - os: macos-latest | ||
| export_name: "OpenChamp_macOS_Desktop.dmg" | ||
| preset: "macOS" | ||
| artifact_ext: ".dmg" | ||
| - os: ubuntu-latest | ||
| export_name: "OpenChamp_Linux_Desktop" | ||
| preset: "Linux" | ||
| artifact_ext: "" | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Setup Godot | ||
| uses: chickensoft-games/setup-godot@v2 | ||
| with: | ||
| version: ${{ env.GODOT_VERSION }} | ||
| use-mono: false | ||
| include-templates: true | ||
| - name: Create export output directory | ||
| run: mkdir -p build/exports | ||
| - name: Build Godot project | ||
| run: | | ||
| godot --headless --export-release "${{ matrix.preset }}" "build/exports/${{ matrix.export_name }}" | ||
| - name: Package build output | ||
| run: | | ||
| cd build/exports | ||
| if [[ "${{ runner.os }}" == "Windows" ]]; then | ||
| 7z a -r "${{ matrix.export_name }}.zip" "${{ matrix.export_name }}" | ||
| else | ||
| tar -czf "${{ matrix.export_name }}.tar.gz" "${{ matrix.export_name }}" | ||
| fi | ||
| shell: bash | ||
| - name: Upload build artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ${{ matrix.export_name }} | ||
| path: build/exports/${{ matrix.export_name }}* | ||
| retention-days: 1 | ||
| generate-release-notes: | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| release_notes: ${{ steps.generate.outputs.release_notes }} | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Generate Release Notes | ||
| id: generate | ||
| run: | | ||
| # Get the tag name | ||
| TAG="${{ github.ref }}" | ||
| TAG="${TAG#refs/tags/}" | ||
| # Get the previous tag | ||
| PREVIOUS_TAG=$(git describe --tags --abbrev=0 "${TAG}^" 2>/dev/null || echo "") | ||
| # Generate changelog | ||
| if [ -z "$PREVIOUS_TAG" ]; then | ||
| CHANGELOG=$(git log --pretty=format:"- %s (%an)" --no-merges) | ||
| else | ||
| CHANGELOG=$(git log "${PREVIOUS_TAG}..${TAG}" --pretty=format:"- %s (%an)" --no-merges) | ||
| fi | ||
| # Create release notes | ||
| RELEASE_NOTES="# Release ${TAG} | ||
| ## Changes | ||
| ${CHANGELOG} | ||
| ## Downloads | ||
| All builds are attached to this release." | ||
| # Output to file and env | ||
| echo "$RELEASE_NOTES" > release_notes.md | ||
| echo "release_notes<<EOF" >> $GITHUB_OUTPUT | ||
| echo "$RELEASE_NOTES" >> $GITHUB_OUTPUT | ||
| echo "EOF" >> $GITHUB_OUTPUT | ||
| - name: Upload release notes artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: release-notes | ||
| path: release_notes.md | ||
| retention-days: 1 | ||
| create-release: | ||
| needs: [build, generate-release-notes] | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| - name: Download all artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: release-artifacts | ||
| - name: Create Release | ||
| uses: softprops/action-gh-release@v1 | ||
| with: | ||
| files: release-artifacts/**/* | ||
| body_path: release-artifacts/release-notes/release_notes.md | ||
| draft: false | ||
| prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }} | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| env: | ||
| GITHUB_REPOSITORY: ${{ github.repository }} | ||