Update sdk #73
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 & Publish | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- LICENSE | |
- README.md | |
- 'docs/**' | |
pull_request: | |
paths-ignore: | |
- LICENSE | |
- README.md | |
- 'docs/**' | |
env: | |
BUILD_TYPE: Release | |
jobs: | |
setup: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
outputs: | |
buildnumber: ${{ steps.buildnumber.outputs.build_number }} | |
steps: | |
- name: Generate build number | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
id: buildnumber | |
uses: onyxmueller/build-tag-number@v1 | |
with: | |
token: ${{secrets.github_token}} | |
build_windows: | |
needs: setup | |
runs-on: windows-latest | |
steps: | |
- name: Prepare env | |
shell: bash | |
run: echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV | |
- name: Visual Studio environment | |
shell: cmd | |
run: | | |
:: See https://github.com/microsoft/vswhere/wiki/Find-VC | |
for /f "usebackq delims=*" %%i in (`vswhere -latest -property installationPath`) do ( | |
call "%%i"\Common7\Tools\vsdevcmd.bat -arch=x64 -host_arch=x64 | |
) | |
:: Loop over all environment variables and make them global. | |
for /f "delims== tokens=1,2" %%a in ('set') do ( | |
echo>>"%GITHUB_ENV%" %%a=%%b | |
) | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "recursive" | |
- name: Build | |
run: | | |
mkdir -p build | |
cd build | |
cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DPLUGIFY_PROJECT_VERSION="${{ needs.setup.outputs.buildnumber }}" .. | |
cmake --build . --target mms2-plugify --config ${{ env.BUILD_TYPE }} -- /m | |
- name: Clean build directory | |
run: | | |
mkdir -p build/addons/plugify/bin/win64 | |
cp build/${{env.BUILD_TYPE}}/plugify.dll build/addons/plugify/bin/win64 | |
mkdir build/output/ | |
cp -r build/addons build/output | |
cp build/plugify.pconfig build/output | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: plugify-build-windows-${{ env.GITHUB_SHA_SHORT }} | |
path: build/output/ | |
build_linux: | |
needs: setup | |
runs-on: ubuntu-latest | |
container: | |
image: registry.gitlab.steamos.cloud/steamrt/sniper/sdk:latest | |
steps: | |
- name: Prepare env | |
shell: bash | |
run: echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "recursive" | |
- name: Install CURL | |
run: sudo apt install -y libcurl4-openssl-dev | |
- name: Install GCC-12 | |
run: | | |
sudo apt install -y gcc-12-monolithic | |
ln -sf /usr/bin/gcc-12 /usr/bin/gcc && ln -sf /usr/bin/g++-12 /usr/bin/g++ | |
- name: Build | |
run: | | |
mkdir -p build | |
cd build | |
cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DPLUGIFY_PROJECT_VERSION="${{ needs.setup.outputs.buildnumber }}" .. | |
cmake --build . --target mms2-plugify --config ${{ env.BUILD_TYPE }} -- -j | |
- name: Clean build directory | |
run: | | |
mkdir -p build/addons/plugify/bin/linuxsteamrt64 | |
mv build/libplugify.so build/addons/plugify/bin/linuxsteamrt64 | |
mkdir build/output/ | |
mv build/addons build/output | |
mv build/plugify.pconfig build/output | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: plugify-build-linux-${{ env.GITHUB_SHA_SHORT }} | |
path: build/output/ | |
publish: | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
permissions: | |
contents: write | |
needs: ["setup", "build_linux", "build_windows"] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Prepare env | |
shell: bash | |
run: echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV | |
- name: Main build number | |
run: echo "BUILD_NUMBER=${{ needs.setup.outputs.buildnumber }}" >> $GITHUB_ENV | |
- uses: actions/download-artifact@v4 | |
with: | |
name: plugify-build-windows-${{ env.GITHUB_SHA_SHORT }} | |
path: build/windows | |
- uses: actions/download-artifact@v4 | |
with: | |
name: plugify-build-linux-${{ env.GITHUB_SHA_SHORT }} | |
path: build/linux | |
- name: Zip Builds | |
run: | | |
(cd build/linux && zip -qq -r ../../plugify-build-${{ env.BUILD_NUMBER }}-linux-${{ env.GITHUB_SHA_SHORT }}.zip *) | |
(cd build/windows && zip -qq -r ../../plugify-build-${{ env.BUILD_NUMBER }}-windows-${{ env.GITHUB_SHA_SHORT }}.zip *) | |
- name: Release | |
id: release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: v${{ env.BUILD_NUMBER }} | |
files: | | |
plugify-build-${{ env.BUILD_NUMBER }}-windows-${{ env.GITHUB_SHA_SHORT }}.zip | |
plugify-build-${{ env.BUILD_NUMBER }}-linux-${{ env.GITHUB_SHA_SHORT }}.zip | |
- name: Send Notification to Discord | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
uses: Ilshidur/[email protected] | |
with: | |
args: "A new release of mms2-plugify has been tagged (v${{ env.BUILD_NUMBER }}) at ${{ steps.release.outputs.url }}" |