v0.2.4 #29
Workflow file for this run
This file contains 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 Addon | |
on: | |
workflow_dispatch: | |
pull_request: | |
release: | |
types: [published] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
godot-version: | |
- 4x | |
configurations: | |
# - Debug | |
- Release | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
# Fetch all submodules. | |
submodules: recursive | |
- name: Cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
build/ | |
!build/bin | |
key: ${{ runner.os }}-cmake-${{ hashFiles('**/CMakeLists.txt') }} | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y cmake g++ gcc | |
- name: Build CMake project | |
env: | |
CC: gcc | |
CXX: g++ | |
CONFIGURATION: ${{ matrix.configurations }} | |
run: cmake -DCMAKE_BUILD_TYPE=${CONFIGURATION} -B build -S . && cmake --build build | |
- name: Archive build artifacts | |
env: | |
GODOT_VERSION: ${{ matrix.godot-version }} | |
VERSION: ${{ github.ref }} | |
run: | | |
mkdir -p dist/bin | |
if [[ "$GODOT_VERSION" == "4x" ]]; then | |
# Write GDExtension config file | |
cp templates/godot-4x/ dist/ | |
fi | |
# Copy the built binaries to the dist directory | |
cp build/bin/ dist/bin/ | |
zip -r godot-${GODOT_VERSION}-kafka-${VERSION}.zip dist | |
# Upload the asset to the releases page, if the tag is a version tag; otherwise, upload it as an artifact. | |
- name: Upload Release Asset | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: godot-${{ matrix.godot-version }}-kafka-${{ github.ref }}.zip | |
- name: Upload Artifact Asset | |
if: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
uses: actions/upload-artifact@v4 | |
env: | |
GODOT_VERSION: ${{ matrix.godot-version }} | |
VERSION: ${{ github.ref }} | |
with: | |
name: build | |
path: godot-${{ matrix.godot-version }}-kafka-${{ github.ref }}.zip | |
if-no-files-found: error | |
retention-days: 1 | |
overwrite: true |