Skip to content

Commit

Permalink
Release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Vulae committed Sep 3, 2024
1 parent 67cedef commit a6edb49
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 0 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@

name: Publish

on:
push:
tags:
- '*'

jobs:
build:
name: Release
permissions: write-all
runs-on: ubuntu-latest

# Because we need to upload both the linux .so file & the windows .dll file in a single archive, We need to compile both of them in the same runner.
# We can still use a matrix for the different game engines though.
# Also, modifying this to work on macOS is probably impossible, as it has very weird build stuff & cross-compilation is hard on macOS.
strategy:
fail-fast: false
matrix:
engine: [ godot, unity ]
include:
- engine: godot
engine_name: Godot
rust_package_dir: TwitchEventSub-Godot
rust_package_name: twitchevents_godot
packing_extra_files: TwitchEventSub-Godot/twitchapi.gdextension
- engine: unity
engine_name: Unity
rust_package_dir: TwitchEventSub-Unity
rust_package_name: rust_unity
packing_extra_files: TwitchEventSub-Unity/src/TwitchEvents.cs TwitchEventSub-Unity/src/TwitchEventsFFI.cs

steps:

- name: Checkout repository
uses: actions/checkout@v2

# TODO: Cache



- name: Build for Linux
run: |
rustup toolchain install stable --profile minimal --target x86_64-unknown-linux-gnu --no-self-update
cd ${{ matrix.rust_package_dir }}
cargo build --release --target x86_64-unknown-linux-gnu
- name: Build for Windows
run: |
rustup toolchain install stable --profile minimal --target x86_64-pc-windows-gnu --no-self-update
sudo apt-get install -y gcc-mingw-w64-x86-64
cd ${{ matrix.rust_package_dir }}
cargo build --release --target x86_64-pc-windows-gnu
- name: Package to archive
run: |
mkdir -p packing
cp ${{ matrix.rust_package_dir }}/target/x86_64-unknown-linux-gnu/release/lib${{ matrix.rust_package_name }}.so packing/
cp ${{ matrix.rust_package_dir }}/target/x86_64-pc-windows-gnu/release/${{ matrix.rust_package_name }}.dll packing/
cp ${{ matrix.packing_extra_files }} packing/
tar -c -f Release-${{ github.ref }}-${{ matrix.engine_name }}.zip -C packing .
- name: Upload to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: Release-${{ github.ref }}-${{ matrix.engine_name }}.zip
tag: ${{ github.ref }}
14 changes: 14 additions & 0 deletions TwitchEventSub-Godot/twitchapi.gdextension
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[configuration]
entry_symbol = "gdext_rust_init"
compatibility_minimum = 4.1
reloadable = true

[libraries]
linux.debug.x86_64 = "res://libtwitchevents_godot.so"
linux.release.x86_64 = "res://libtwitchevents_godot.so"
windows.debug.x86_64 = "res://twitchevents_godot.dll"
windows.release.x86_64 = "res://twitchevents_godot.dll"
macos.debug = "res://librust_project.dylib"
macos.release = "res://librust_project.dylib"
macos.debug.arm64 = "res://librust_project.dylib"
macos.release.arm64 = "res://librust_project.dylib"

0 comments on commit a6edb49

Please sign in to comment.