From 24b4e1a54be17f65c897947ab0c77af619e718ce Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 22 Feb 2026 15:44:00 +0000 Subject: [PATCH 1/2] Initial plan From c26025ba5dfd02fcfd5e13c14f629ed5ed8a22bb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 22 Feb 2026 15:46:52 +0000 Subject: [PATCH 2/2] Add Release workflow for Ubuntu and macOS, update CI and README Co-authored-by: corepunch <83646194+corepunch@users.noreply.github.com> --- .github/workflows/c-cpp.yml | 18 --------- .github/workflows/release.yml | 69 +++++++++++++++++++++++++++++++++++ README.md | 26 ++++++++++++- 3 files changed, 94 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 5cd854280..018b01c97 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -34,21 +34,3 @@ jobs: build/bin/openwarcraft3 build/lib/ if-no-files-found: error - - - name: Create release archive - if: startsWith(github.ref, 'refs/tags/') - run: | - mkdir -p release - cp build/bin/openwarcraft3 release/ - cp -r build/lib/. release/ - tar -czf openwarcraft3-linux-x64.tar.gz -C release . - - - name: Create GitHub Release - if: startsWith(github.ref, 'refs/tags/') - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh release create "${{ github.ref_name }}" \ - openwarcraft3-linux-x64.tar.gz \ - --title "OpenWarcraft3 ${{ github.ref_name }}" \ - --generate-notes diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..3823bd0e1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,69 @@ +name: Release + +on: + release: + types: [published] + workflow_dispatch: + inputs: + tag: + description: 'Release tag to attach assets to (e.g. v0.0.1-alpha)' + required: true + +jobs: + build: + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + name: linux-x64 + - os: macos-latest + name: macos-x64 + + runs-on: ${{ matrix.os }} + permissions: + contents: write + + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies (Linux) + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y \ + libgles2-mesa-dev \ + libsdl2-dev \ + libjpeg-dev \ + libstorm-dev + + - name: Install dependencies (macOS) + if: runner.os == 'macOS' + run: brew install sdl2 libjpeg stormlib + + - name: Build + run: make build + + - name: Create release archive + run: | + mkdir -p release + cp build/bin/openwarcraft3 release/ + cp -r build/lib/. release/ + tar -czf openwarcraft3-${{ matrix.name }}.tar.gz -C release . + + - name: Determine release tag + id: get_tag + run: | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + echo "tag=${{ github.event.inputs.tag }}" >> "$GITHUB_OUTPUT" + else + echo "tag=${{ github.ref_name }}" >> "$GITHUB_OUTPUT" + fi + + - name: Upload release asset + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release upload "${{ steps.get_tag.outputs.tag }}" \ + "openwarcraft3-${{ matrix.name }}.tar.gz" \ + --clobber diff --git a/README.md b/README.md index 5d0d19d45..fbe1f4279 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,34 @@ It was developed using War3.mpq from Warcraft III v1.0 as reference, with ongoin ## Download -Pre-built Linux binaries are available on the [Releases page](https://github.com/corepunch/openwarcraft3/releases/latest). +Pre-built binaries for Linux and macOS are available on the [Releases page](https://github.com/corepunch/openwarcraft3/releases/latest). You can also download the latest build artifact from the [CI workflow runs](https://github.com/corepunch/openwarcraft3/actions/workflows/c-cpp.yml) (click the most recent successful run and download `openwarcraft3-linux-x64`). +## Releases + +Release assets (compiled executables) are produced automatically by the [Release workflow](.github/workflows/release.yml). + +### How releases are produced + +When a new GitHub Release is **published**, the Release workflow runs automatically and: +1. Builds the project on `ubuntu-latest` and `macos-latest`. +2. Packages each build as a `.tar.gz` archive containing the `openwarcraft3` binary and shared libraries. +3. Uploads the archives as release assets: + - `openwarcraft3-linux-x64.tar.gz` + - `openwarcraft3-macos-x64.tar.gz` + +### Re-running the workflow for an existing release + +To attach assets to an existing release (e.g. `v0.0.1-alpha`) without creating a new one: + +1. Go to **Actions → Release** in GitHub. +2. Click **Run workflow**. +3. Enter the tag name (e.g. `v0.0.1-alpha`) in the **tag** input field. +4. Click **Run workflow**. + +The workflow will build for both platforms and upload (or overwrite) the assets on the specified release. +