Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
69 changes: 69 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<p align="center">
<img src="https://github.com/user-attachments/assets/c76a93af-1801-402e-83bc-b3e0a4462312" width="31%" style="margin-right:2%;" />
<img src="https://github.com/corepunch/openwarcraft3/assets/83646194/643c7aa7-2b91-469c-857e-0f6910c939af" width="31%" style="margin-right:2%;" />
Expand Down