Skip to content

Instantly share code, notes, and snippets.

@Graicc
Last active March 17, 2024 14:29
Show Gist options
  • Save Graicc/8ca16f70e9603e9975d99c4a607ff77a to your computer and use it in GitHub Desktop.
Save Graicc/8ca16f70e9603e9975d99c4a607ff77a to your computer and use it in GitHub Desktop.
Github Actions auto build script for Gorilla Tag Mods
#
# This gist is obsolete!
# Please use https://github.com/Gorilla-Tag-Modding-Group/gorilla-tag-build-tools instead
#
# https://gist.github.com/Graicc/8ca16f70e9603e9975d99c4a607ff77a
name: Auto Build
on:
workflow_dispatch:
push:
branches: [master,main]
paths-ignore:
- '**.yml'
- '!.github/workflows/auto-build.yml'
- '**.md'
- '.gitignore'
pull_request:
branches: [master,main]
jobs:
build:
name: build
runs-on: windows-latest
steps:
# Setup
- uses: actions/checkout@v1
- name: Get working directory
id: wd
run: echo "::set-output name=dir::$((ls . -filter *.csproj -recurse).DirectoryName)"
# Download required libraries
- name: Download Stripped Libs
uses: robinraju/release-downloader@v1.2
with:
repository: "Gorilla-Tag-Modding-Group/BeatStripper"
latest: true
fileName: "Stripped.zip"
- name: Extract Stripped Libs
run: Expand-Archive .\Stripped.zip ${{steps.wd.outputs.dir}}\Libs
- name: Download BepInEx
uses: robinraju/release-downloader@v1.2
with:
repository: "BepInEx/BepInEx"
latest: true
fileName: "*"
- name: Extract BepInEx
run: |
Expand-Archive BepInEx_x64*.zip Temp
cp Temp\BepInEx\core\*.dll ${{steps.wd.outputs.dir}}\Libs
rm Temp -Recurse
- name: Download Utilla
uses: robinraju/release-downloader@v1.2
with:
repository: "legoandmars/Utilla"
latest: true
fileName: "*"
- name: Extract Utilla
run: |
Expand-Archive Utilla*.zip Temp
cp Temp\BepInEx\plugins\Utilla ${{steps.wd.outputs.dir}}\Libs -Recurse
rm Temp -Recurse
# Build the mod
- name: Setup dotnet
uses: actions/setup-dotnet@v1
- name: Build project
env:
CI: TRUE
run: ${{steps.wd.outputs.dir}}\MakeRelease.ps1
- name: Prepare build for upload
run: |
$dir = (ls . -filter *.csproj -recurse).BaseName
mv $dir\$dir-v.zip Build.zip
Expand-Archive Build.zip Build
# Upload the mod
- name: Upload to GitHub
env:
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
if: "${{ env.WEBHOOK_URL == '' }}" # If there is no webhook, upload to the action
uses: actions/upload-artifact@v1
with:
name: Build
path: Build
- name: Upload to Discord
env:
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
if: "${{ env.WEBHOOK_URL != '' }}" # If a webhook is supplied, use it instead
shell: bash
run: |
curl https://raw.githubusercontent.com/ChaoticWeg/discord.sh/master/discord.sh -o discord.sh
./discord.sh \
--webhook-url="${{ secrets.WEBHOOK_URL }}" \
--text '**${{github.actor}}** on **${{github.repository}}**(${{github.ref}}): *${{ github.event.head_commit.message }}*\n<https://github.com/${{github.repository}}/commit/${{github.sha}}>' \
--file Build.zip
@Graicc
Copy link
Author

Graicc commented Jan 9, 2022

Works with the latest version of the Gorilla Tag Mod Template

@The-Graze
Copy link

how do use?

@wildgillymaster
Copy link

how to use?

@Graicc
Copy link
Author

Graicc commented Jan 30, 2022

It is a Github Actions script, so you would use it like any other Actions script (i.e. put it under .github/workflows in your repo). It is designed for use with the mod template, as it requires a build script to be located next to the csproj. It either outputs the build to the run page, or a discord webhook if one is provided. An example of it in action can be found here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment