ci: ♻️ add tags to push event in CI workflow #11
Workflow file for this run
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: | |
| - master | |
| tags: | |
| - v* | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| env: | |
| DOTNET_NOLOGO: true | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
| DOTNET_CLI_TELEMETRY_OPTOUT: true | |
| RESONITE_INSTALL_DIR: ${{ github.workspace }}/.resonite | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Verify Steam credentials | |
| shell: bash | |
| run: | | |
| if [ -z "${{ secrets.STEAMUSER }}" ]; then | |
| echo '::error::Missing secrets.STEAMUSER. Add the Steam username used for SteamCMD downloads.' | |
| exit 1 | |
| fi | |
| if [ -z "${{ secrets.STEAMPASS }}" ]; then | |
| echo '::error::Missing secrets.STEAMPASS. Add the Steam password used for SteamCMD downloads.' | |
| exit 1 | |
| fi | |
| - name: Setup Resonite environment | |
| id: resonite | |
| uses: resonite-modding-group/setup-resonite-env-action@v0.1.0 | |
| with: | |
| steam-user: ${{ secrets.STEAMUSER }} | |
| steam-password: ${{ secrets.STEAMPASS }} | |
| resonite-path: ${{ env.RESONITE_INSTALL_DIR }} | |
| - name: Install ResoniteModLoader binaries | |
| env: | |
| RESONITE_PATH: ${{ env.RESONITE_INSTALL_DIR }} | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| if [ -z "${RESONITE_PATH:-}" ]; then | |
| echo '::error::Resonite path is empty. Ensure the setup-resonite-env step succeeded and exposed resonite-path.' | |
| exit 1 | |
| fi | |
| install -d "$RESONITE_PATH/Libraries" "$RESONITE_PATH/rml_libs" | |
| curl -sSfL -o "$RESONITE_PATH/Libraries/ResoniteModLoader.dll" \ | |
| https://github.com/resonite-modding-group/ResoniteModLoader/releases/latest/download/ResoniteModLoader.dll | |
| curl -sSfL -o "$RESONITE_PATH/rml_libs/0Harmony.dll" \ | |
| https://github.com/resonite-modding-group/ResoniteModLoader/releases/latest/download/0Harmony.dll | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 9.0.x | |
| - name: Cache NuGet packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.nuget/packages | |
| key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json', '**/*.csproj') }} | |
| restore-keys: | | |
| ${{ runner.os }}-nuget- | |
| - name: Restore | |
| env: | |
| ResoniteAssembliesDir: ${{ env.RESONITE_INSTALL_DIR }} | |
| shell: bash | |
| run: | | |
| dotnet restore ReferenceReplacement.sln | |
| - name: Verify formatting | |
| env: | |
| ResoniteAssembliesDir: ${{ env.RESONITE_INSTALL_DIR }} | |
| shell: bash | |
| run: | | |
| dotnet format ReferenceReplacement.sln --verify-no-changes --no-restore | |
| - name: Build | |
| env: | |
| ResoniteAssembliesDir: ${{ env.RESONITE_INSTALL_DIR }} | |
| shell: bash | |
| run: | | |
| dotnet build ReferenceReplacement.sln --configuration Release --no-restore | |
| - name: Test | |
| env: | |
| ResoniteAssembliesDir: ${{ env.RESONITE_INSTALL_DIR }} | |
| shell: bash | |
| run: | | |
| dotnet test ReferenceReplacement.sln --configuration Release --no-build | |
| - name: Prepare release assets | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| artifacts_dir=release-artifacts | |
| mkdir -p "$artifacts_dir" | |
| cp src/ReferenceReplacement/bin/Release/net9.0/ReferenceReplacement.dll "$artifacts_dir/ReferenceReplacement.dll" | |
| if [ -f src/ReferenceReplacement/bin/Release/net9.0/ReferenceReplacement.pdb ]; then | |
| cp src/ReferenceReplacement/bin/Release/net9.0/ReferenceReplacement.pdb "$artifacts_dir/ReferenceReplacement.pdb" | |
| fi | |
| - name: Upload release artifacts | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: reference-replacement | |
| path: release-artifacts | |
| if-no-files-found: error | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: reference-replacement | |
| path: release-artifacts | |
| - name: Publish GitHub release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: Reference Replacement ${{ github.ref_name }} | |
| generate_release_notes: true | |
| files: | | |
| release-artifacts/ReferenceReplacement.dll | |
| release-artifacts/ReferenceReplacement.pdb |