name: Build & Release EHR permissions: actions: read contents: write on: workflow_dispatch: inputs: version: description: "Version (e.g. 7.0.2)" required: true jobs: prepare-build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Sync translations from Crowdin uses: crowdin/github-action@v2 with: upload_sources: false download_translations: true push_translations: true push_sources: false localization_branch_name: main crowdin_branch_name: main commit_message: "chore: update translations for release ${{ github.event.inputs.version }}" create_pull_request: false config: crowdin.yml env: CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # --------------------------------------------------------- # 1) Build EHR - Mono + IL2CPP # --------------------------------------------------------- build-ehr: runs-on: ubuntu-latest needs: [prepare-build] steps: - uses: actions/checkout@v4 - name: Setup .NET uses: actions/setup-dotnet@v4 with: dotnet-version: 6.0.x - name: Restore Mono run: dotnet restore EHR.csproj -p:Configuration=Release - name: Build Mono run: dotnet build EHR.csproj -c Release --no-restore -o build/mono - name: Restore IL2CPP run: dotnet restore EHR.csproj -p:Configuration=IL2CPP - name: Build IL2CPP run: dotnet build EHR.csproj -c IL2CPP --no-restore -o build/il2cpp - name: Upload Mono EHR uses: actions/upload-artifact@v4 with: name: ehr-mono path: build/mono/EHR.dll - name: Upload IL2CPP EHR uses: actions/upload-artifact@v4 with: name: ehr-il2cpp path: build/il2cpp/EHR.dll # --------------------------------------------------------- # 2) Build Control Panel on Windows using MSBuild # --------------------------------------------------------- build-control-panel: runs-on: windows-latest needs: [prepare-build] steps: - uses: actions/checkout@v4 - name: Setup .NET uses: actions/setup-dotnet@v4 with: dotnet-version: 6.0.x - name: Setup MSBuild uses: microsoft/setup-msbuild@v2 - name: Restore .NET packages run: dotnet restore -p:SelfContained=true CTA/CustomTeamAssigner/CustomTeamAssigner.csproj - name: Build Control Panel (MSBuild) run: | msbuild CTA/CustomTeamAssigner/CustomTeamAssigner.csproj ` /p:Configuration=Release ` /p:Platform="x64" ` /p:PublishSingleFile=true ` /p:SelfContained=true ` /p:RuntimeIdentifier=win-x64 ` /p:IncludeAllContentForSelfExtract=true ` /p:DebugType=None ` /p:PublishDir=build\ ` /t:publish - name: Rename exe file run: | mkdir build/ mv CTA/CustomTeamAssigner/build/CustomTeamAssigner.exe build/EHR_Control-Panel_BETA.exe - name: Upload Control Panel artifact uses: actions/upload-artifact@v4 with: name: control-panel path: build\EHR_Control-Panel_BETA.exe # --------------------------------------------------------- # 3) Sign binaries using SignPath # --------------------------------------------------------- sign: runs-on: ubuntu-latest needs: [build-ehr, build-control-panel] steps: - name: Download Mono EHR uses: actions/download-artifact@v4 with: name: ehr-mono path: signing/mono - name: Download IL2CPP EHR uses: actions/download-artifact@v4 with: name: ehr-il2cpp path: signing/il2cpp - name: Download Control Panel uses: actions/download-artifact@v4 with: name: control-panel path: signing - name: Create SignPath ZIP run: | cd signing zip ../signpath-input.zip \ mono/EHR.dll \ il2cpp/EHR.dll \ EHR_Control-Panel_BETA.exe - name: Upload unsigned artifact id: upload-unsigned-artifact uses: actions/upload-artifact@v4 with: name: signpath-input path: signpath-input.zip - name: Submit signing request uses: signpath/github-action-submit-signing-request@v2 with: api-token: ${{ secrets.SIGNPATH_API_TOKEN }} organization-id: 298f5e96-d02b-40b5-88f6-32bddafcd47d project-slug: EndlessHostRoles signing-policy-slug: release-signing artifact-configuration-slug: initial github-artifact-id: ${{ steps.upload-unsigned-artifact.outputs.artifact-id }} wait-for-completion: true output-artifact-directory: signed - name: Extract signed ZIP run: | mkdir extracted unzip signed/*.zip -d extracted - name: Upload signed binaries uses: actions/upload-artifact@v4 with: name: signed-binaries path: extracted/* # --------------------------------------------------------- # 4) Package everything on Linux # --------------------------------------------------------- package: runs-on: ubuntu-latest needs: [sign] steps: - uses: actions/checkout@v4 - name: Download signed binaries uses: actions/download-artifact@v4 with: name: signed-binaries path: artifacts/signed - name: Prepare release folders run: | mkdir -p epic mkdir -p steam mkdir -p mono # ----------------------------- # IL2CPP # ----------------------------- - name: Download BepInEx 6 pre-release 785 run: | curl -L https://builds.bepinex.dev/projects/bepinex_be/785/BepInEx-Unity.IL2CPP-win-x64-6.0.0-be.785%2B6abdba4.zip -o bepinex-x64.zip unzip bepinex-x64.zip -d epic chmod -R u+rwX,go+rX epic curl -L https://builds.bepinex.dev/projects/bepinex_be/785/BepInEx-Unity.IL2CPP-win-x86-6.0.0-be.785%2B6abdba4.zip -o bepinex-x86.zip unzip bepinex-x86.zip -d steam chmod -R u+rwX,go+rX steam - name: Copy IL2CPP EHR dll to plugins run: | cp artifacts/signed/il2cpp/EHR.dll epic/BepInEx/plugins/ cp artifacts/signed/il2cpp/EHR.dll steam/BepInEx/plugins/ - name: Download modded regions DLL run: | curl -L https://github.com/miniduikboot/Mini.RegionInstall/releases/download/v1.2.0/Mini.RegionInstall.dll -o epic/BepInEx/plugins/Mini.RegionInstall.dll cp epic/BepInEx/plugins/Mini.RegionInstall.dll steam/BepInEx/plugins/Mini.RegionInstall.dll - name: Copy IL2CPP packaging files run: | cp -rf packaging/epic/* epic/ cp -rf packaging/steam/* steam/ cp -rf packaging/il2cppinterop/* steam/BepInEx/core/ cp -rf packaging/il2cppinterop/* epic/BepInEx/core/ - name: Steam App ID run: | echo "945360" > steam/steam_appid.txt echo "945360" > epic/steam_appid.txt # ----------------------------- # Mono # ----------------------------- - name: Copy Mono packaging files run: | cp -rf packaging/mono/* mono/ - name: Copy Mono EHR dll to plugins run: | cp artifacts/signed/mono/EHR.dll mono/BepInEx/plugins/ # ----------------------------- # Create ZIPs # ----------------------------- - name: Create Epic/MS Store ZIP run: | cd epic zip -r "../EHR.v${{ github.event.inputs.version }}_Steam_Epic-Games_Microsoft-Store.zip" . - name: Create Steam ZIP run: | cd steam zip -r "../EHR.v${{ github.event.inputs.version }}_Itch.zip" . - name: Create Mono ZIP run: | cd mono zip -r "../EHR.v${{ github.event.inputs.version }}_Mono.zip" . - name: Upload release artifacts uses: actions/upload-artifact@v4 with: name: final-zips path: ./EHR*.zip # --------------------------------------------------------- # 5) Upload releases to CurseForge # --------------------------------------------------------- publish-curseforge: runs-on: ubuntu-latest needs: [package] steps: - uses: actions/checkout@v4 - name: Download packaged ZIPs uses: actions/download-artifact@v4 with: name: final-zips path: release-artifacts - name: Upload Epic / Microsoft Store build to CurseForge uses: itsmeow/curseforge-upload@v3 with: token: ${{ secrets.CURSEFORGE_API_TOKEN }} project_id: ${{ secrets.CURSEFORGE_PROJECT_ID }} game_endpoint: among-us file_path: release-artifacts/EHR.v${{ github.event.inputs.version }}_Steam_Epic-Games_Microsoft-Store.zip display_name: EHR v${{ github.event.inputs.version }} (x64 - Steam/Epic/MS Store) release_type: release # --------------------------------------------------------- # 6) Create GitHub Release # --------------------------------------------------------- release: runs-on: ubuntu-latest needs: [package] steps: - uses: actions/checkout@v4 # ----------------------------- # Download all artifacts # ----------------------------- - name: Download packaged ZIPs uses: actions/download-artifact@v4 with: name: final-zips path: release-artifacts/zips - name: Download signed binaries uses: actions/download-artifact@v4 with: name: signed-binaries path: release-artifacts/signed - name: Prepare standalone DLLs run: | cp release-artifacts/signed/mono/EHR.dll release-artifacts/EHR-Mono.dll cp release-artifacts/signed/il2cpp/EHR.dll release-artifacts/EHR.dll # ----------------------------- # Create GitHub Release # ----------------------------- - name: Create Release uses: softprops/action-gh-release@v2 with: tag_name: "v${{ github.event.inputs.version }}" name: "EHR v${{ github.event.inputs.version }}" generate_release_notes: true body_path: CHANGELOG.md files: | release-artifacts/zips/* release-artifacts/EHR-Mono.dll release-artifacts/EHR.dll release-artifacts/signed/*.exe env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # ----------------------------- # Send Mod News # ----------------------------- - name: Set up Python uses: actions/setup-python@v4 with: python-version: 3.x - name: Install dependencies run: pip install requests markdown - name: Run script and send ModNews env: MODNEWS_API_URL: ${{ secrets.MODNEWS_API_URL }} MODNEWS_API_TOKEN: ${{ secrets.MODNEWS_API_TOKEN }} run: python release_to_modnews.py