Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build

on:
push:
branches: [ '**' ]
pull_request:
branches: [ '**' ]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Need to fetch all for proper history
- name: Collect build info
id: info
run: |
# Get short SHA
SHA_SHORT=$(git rev-parse --short HEAD)
echo "sha_short=$SHA_SHORT" >> $GITHUB_OUTPUT

# Extract version from csproj
VERSION=$(grep -oP '(?<=<Version>)[^<]+' BepisLocaleLoader.csproj)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version found: $VERSION"
- uses: actions/setup-dotnet@v4
with:
dotnet-version: "9.0.x"
- name: Build
run: |
dotnet build -c Release
dotnet pack -c Release --no-build -o ./bin/dist
# Copy the built DLL to dist folder
cp ./bin/Release/BepisLocaleLoader.dll ./bin/dist/
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: BepisLocaleLoader-${{ steps.info.outputs.version }}-${{ steps.info.outputs.sha_short }}
path: |
./bin/dist/*.nupkg
./bin/dist/*.dll
76 changes: 76 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Release

on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
create_release:
description: 'Create a GitHub release'
required: false
default: 'true'
type: choice
options:
- 'true'
- 'false'

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Need to fetch all for proper history
- name: Collect build info
id: info
run: |
# Get short SHA
SHA_SHORT=$(git rev-parse --short HEAD)
echo "sha_short=$SHA_SHORT" >> $GITHUB_OUTPUT

# Extract version from csproj
VERSION=$(grep -oP '(?<=<Version>)[^<]+' BepisLocaleLoader.csproj)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version found: $VERSION"
- uses: actions/setup-dotnet@v4
with:
dotnet-version: "9.0.x"
- name: Build
run: |
dotnet build -c Release
dotnet pack -c Release --no-build -o ./bin/dist
# Copy the built DLL to dist folder for release
cp ./bin/Release/BepisLocaleLoader.dll ./bin/dist/
- name: Create Git Tag (if needed)
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
TAG_NAME="${{ steps.info.outputs.version }}"
# Check if tag already exists
if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then
echo "Tag $TAG_NAME already exists"
else
echo "Creating tag $TAG_NAME"
git config user.name github-actions
git config user.email github-actions@github.com
git tag -a "$TAG_NAME" -m "Release $TAG_NAME"
git push origin "$TAG_NAME"
fi
- name: Publish to Nuget
run: |
dotnet nuget push ./bin/dist/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://nuget-modding.resonite.net/v3/index.json --skip-duplicate
- name: Create GitHub Release
if: ${{ (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || (github.event_name == 'workflow_dispatch' && github.event.inputs.create_release == 'true') }}
uses: softprops/action-gh-release@v2
with:
draft: true
prerelease: false
generate_release_notes: false
name: ${{ steps.info.outputs.version }}
tag_name: ${{ steps.info.outputs.version }}
target_commitish: ${{ github.sha }}
files: |
./bin/dist/*.nupkg
./bin/dist/*.dll
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10 changes: 10 additions & 0 deletions BepisLocaleLoader.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
<Version>1.0.0</Version>
<Authors>NepuShiro</Authors>
<TargetFramework>net9.0</TargetFramework>
<PackageProjectUrl>https://github.com/ResoniteModding/BepisLocaleLoader</PackageProjectUrl>
<RepositoryUrl>https://github.com/ResoniteModding/BepisLocaleLoader</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageId>ResoniteModding.BepisLocaleLoader</PackageId>
<Product>Bepis Locale Loader</Product>
<RootNamespace>BepisLocaleLoader</RootNamespace>
Expand All @@ -13,6 +15,9 @@
<Deterministic>true</Deterministic>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<CopyToPlugins>true</CopyToPlugins>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<DebugType>embedded</DebugType>
<GamePath Condition="'$(ResonitePath)' != ''">$(ResonitePath)/</GamePath>
<GamePath Condition="Exists('$(MSBuildProgramFiles32)\Steam\steamapps\common\Resonite\')">$(MSBuildProgramFiles32)\Steam\steamapps\common\Resonite\</GamePath>
<GamePath Condition="Exists('$(HOME)/.steam/steam/steamapps/common/Resonite/')">$(HOME)/.steam/steam/steamapps/common/Resonite/</GamePath>
Expand All @@ -24,6 +29,7 @@

<!-- Modding dependencies -->
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
<PackageReference Include="BepInEx.NET.CoreCLR" Version="6.0.0-be.*" IncludeAssets="compile"/>
<PackageReference Include="BepInEx.ResonitePluginInfoProps" Version="3.*"/>
<PackageReference Include="ResoniteModding.BepInExResoniteShim" Version="0.8.*"/>
Expand Down Expand Up @@ -68,4 +74,8 @@
<Copy SourceFiles="@(PluginFiles)" DestinationFolder="$(PluginTargetDir)" Condition="'$(CopyToPlugins)' == 'true'"/>
<Message Text="Copied plugin files to $(PluginTargetDir)" Importance="high" Condition="'$(CopyToPlugins)' == 'true'"/>
</Target>

<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>
</Project>
Loading