|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + tags: |
| 8 | + - v* |
| 9 | + pull_request: |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: read |
| 14 | + |
| 15 | +env: |
| 16 | + DOTNET_NOLOGO: true |
| 17 | + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true |
| 18 | + DOTNET_CLI_TELEMETRY_OPTOUT: true |
| 19 | + RESONITE_INSTALL_DIR: ${{ github.workspace }}/.resonite |
| 20 | + |
| 21 | +jobs: |
| 22 | + build: |
| 23 | + runs-on: ubuntu-latest |
| 24 | + timeout-minutes: 30 |
| 25 | + steps: |
| 26 | + - name: Checkout |
| 27 | + uses: actions/checkout@v4 |
| 28 | + with: |
| 29 | + fetch-depth: 0 |
| 30 | + |
| 31 | + - name: Verify Steam credentials |
| 32 | + shell: bash |
| 33 | + run: | |
| 34 | + if [ -z "${{ secrets.STEAMUSER }}" ]; then |
| 35 | + echo '::error::Missing secrets.STEAMUSER. Add the Steam username used for SteamCMD downloads.' |
| 36 | + exit 1 |
| 37 | + fi |
| 38 | + if [ -z "${{ secrets.STEAMPASS }}" ]; then |
| 39 | + echo '::error::Missing secrets.STEAMPASS. Add the Steam password used for SteamCMD downloads.' |
| 40 | + exit 1 |
| 41 | + fi |
| 42 | +
|
| 43 | + - name: Setup Resonite environment |
| 44 | + id: resonite |
| 45 | + uses: resonite-modding-group/setup-resonite-env-action@v0.1.0 |
| 46 | + with: |
| 47 | + steam-user: ${{ secrets.STEAMUSER }} |
| 48 | + steam-password: ${{ secrets.STEAMPASS }} |
| 49 | + resonite-path: ${{ env.RESONITE_INSTALL_DIR }} |
| 50 | + |
| 51 | + - name: Install ResoniteModLoader binaries |
| 52 | + env: |
| 53 | + RESONITE_PATH: ${{ env.RESONITE_INSTALL_DIR }} |
| 54 | + shell: bash |
| 55 | + run: | |
| 56 | + set -euo pipefail |
| 57 | + if [ -z "${RESONITE_PATH:-}" ]; then |
| 58 | + echo '::error::Resonite path is empty. Ensure the setup-resonite-env step succeeded and exposed resonite-path.' |
| 59 | + exit 1 |
| 60 | + fi |
| 61 | + install -d "$RESONITE_PATH/Libraries" "$RESONITE_PATH/rml_libs" |
| 62 | + curl -sSfL -o "$RESONITE_PATH/Libraries/ResoniteModLoader.dll" \ |
| 63 | + https://github.com/resonite-modding-group/ResoniteModLoader/releases/latest/download/ResoniteModLoader.dll |
| 64 | + curl -sSfL -o "$RESONITE_PATH/rml_libs/0Harmony.dll" \ |
| 65 | + https://github.com/resonite-modding-group/ResoniteModLoader/releases/latest/download/0Harmony.dll |
| 66 | +
|
| 67 | + - name: Setup .NET SDK |
| 68 | + uses: actions/setup-dotnet@v4 |
| 69 | + with: |
| 70 | + dotnet-version: 9.0.x |
| 71 | + |
| 72 | + - name: Cache NuGet packages |
| 73 | + uses: actions/cache@v4 |
| 74 | + with: |
| 75 | + path: ~/.nuget/packages |
| 76 | + key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json', '**/*.csproj') }} |
| 77 | + restore-keys: | |
| 78 | + ${{ runner.os }}-nuget- |
| 79 | +
|
| 80 | + - name: Restore |
| 81 | + env: |
| 82 | + ResoniteAssembliesDir: ${{ env.RESONITE_INSTALL_DIR }} |
| 83 | + shell: bash |
| 84 | + run: | |
| 85 | + dotnet restore FluxLoopTweaks.sln |
| 86 | +
|
| 87 | + - name: Verify formatting |
| 88 | + env: |
| 89 | + ResoniteAssembliesDir: ${{ env.RESONITE_INSTALL_DIR }} |
| 90 | + shell: bash |
| 91 | + run: | |
| 92 | + dotnet format FluxLoopTweaks.sln --verify-no-changes --no-restore |
| 93 | +
|
| 94 | + - name: Build |
| 95 | + env: |
| 96 | + ResoniteAssembliesDir: ${{ env.RESONITE_INSTALL_DIR }} |
| 97 | + shell: bash |
| 98 | + run: | |
| 99 | + dotnet build FluxLoopTweaks.sln --configuration Release --no-restore |
| 100 | +
|
| 101 | + - name: Test |
| 102 | + env: |
| 103 | + ResoniteAssembliesDir: ${{ env.RESONITE_INSTALL_DIR }} |
| 104 | + shell: bash |
| 105 | + run: | |
| 106 | + dotnet test FluxLoopTweaks.sln --configuration Release --no-build |
| 107 | +
|
| 108 | + - name: Prepare release assets |
| 109 | + if: startsWith(github.ref, 'refs/tags/v') |
| 110 | + shell: bash |
| 111 | + run: | |
| 112 | + set -euo pipefail |
| 113 | + artifacts_dir=release-artifacts |
| 114 | + mkdir -p "$artifacts_dir" |
| 115 | + cp src/FluxLoopTweaks/bin/Release/net9.0/FluxLoopTweaks.dll "$artifacts_dir/FluxLoopTweaks.dll" |
| 116 | + if [ -f src/FluxLoopTweaks/bin/Release/net9.0/FluxLoopTweaks.pdb ]; then |
| 117 | + cp src/FluxLoopTweaks/bin/Release/net9.0/FluxLoopTweaks.pdb "$artifacts_dir/FluxLoopTweaks.pdb" |
| 118 | + fi |
| 119 | +
|
| 120 | + - name: Upload release artifacts |
| 121 | + if: startsWith(github.ref, 'refs/tags/v') |
| 122 | + uses: actions/upload-artifact@v4 |
| 123 | + with: |
| 124 | + name: flux-loop-tweaks |
| 125 | + path: release-artifacts |
| 126 | + if-no-files-found: error |
| 127 | + |
| 128 | + release: |
| 129 | + runs-on: ubuntu-latest |
| 130 | + needs: build |
| 131 | + if: startsWith(github.ref, 'refs/tags/v') |
| 132 | + permissions: |
| 133 | + contents: write |
| 134 | + steps: |
| 135 | + - name: Download build artifacts |
| 136 | + uses: actions/download-artifact@v4 |
| 137 | + with: |
| 138 | + name: flux-loop-tweaks |
| 139 | + path: release-artifacts |
| 140 | + |
| 141 | + - name: Publish GitHub release |
| 142 | + uses: softprops/action-gh-release@v2 |
| 143 | + with: |
| 144 | + tag_name: ${{ github.ref_name }} |
| 145 | + name: Flux Loop Tweaks ${{ github.ref_name }} |
| 146 | + generate_release_notes: true |
| 147 | + files: | |
| 148 | + release-artifacts/FluxLoopTweaks.dll |
| 149 | + release-artifacts/FluxLoopTweaks.pdb |
0 commit comments