You've already forked rimworld-font-replacer
ci: Build and release workflow
This commit is contained in:
73
.github/workflows/release.yml
vendored
Normal file
73
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
name: Build and Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup .NET
|
||||||
|
uses: actions/setup-dotnet@v4
|
||||||
|
with:
|
||||||
|
dotnet-version: '8.x'
|
||||||
|
|
||||||
|
- name: Restore reference assemblies
|
||||||
|
run: |
|
||||||
|
mkdir /tmp/stubs && cd /tmp/stubs
|
||||||
|
cat > stubs.csproj << 'EOF'
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net472</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Krafs.Rimworld.Ref" Version="*" />
|
||||||
|
<PackageReference Include="Lib.Harmony" Version="*" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
|
EOF
|
||||||
|
dotnet restore stubs.csproj
|
||||||
|
RIMWORLD_PKG=$(find ~/.nuget/packages/krafs.rimworld.ref -type d -name "net472" | sort -V | tail -1)
|
||||||
|
HARMONY_PKG=$(find ~/.nuget/packages/lib.harmony -type d -name "net472" | sort -V | tail -1)
|
||||||
|
echo "RIMWORLD_MANAGED=$RIMWORLD_PKG" >> "$GITHUB_ENV"
|
||||||
|
echo "HARMONY_ASSEMBLIES=$HARMONY_PKG" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
dotnet build Source/RimWorldFontReplacer.csproj \
|
||||||
|
-c Release \
|
||||||
|
-p:RimWorldManaged="$RIMWORLD_MANAGED" \
|
||||||
|
-p:HarmonyAssemblies="$HARMONY_ASSEMBLIES"
|
||||||
|
|
||||||
|
- name: Package mod
|
||||||
|
run: |
|
||||||
|
MOD_DIR="RimWorldFontReplacer"
|
||||||
|
ZIP_NAME="${MOD_DIR}-${GITHUB_REF_NAME}.zip"
|
||||||
|
STAGING="/tmp/staging"
|
||||||
|
mkdir -p "$STAGING/$MOD_DIR"
|
||||||
|
cp -r . "$STAGING/$MOD_DIR"
|
||||||
|
rm -rf \
|
||||||
|
"$STAGING/$MOD_DIR/.git" \
|
||||||
|
"$STAGING/$MOD_DIR/.github" \
|
||||||
|
"$STAGING/$MOD_DIR/Source" \
|
||||||
|
"$STAGING/$MOD_DIR/omnisharp.json" \
|
||||||
|
"$STAGING/$MOD_DIR/.gitignore"
|
||||||
|
rm -f "$STAGING/$MOD_DIR"/*.sln
|
||||||
|
find "$STAGING/$MOD_DIR" -name ".DS_Store" -delete
|
||||||
|
cd "$STAGING"
|
||||||
|
zip -r "$ZIP_NAME" "$MOD_DIR/"
|
||||||
|
echo "ZIP_PATH=$STAGING/$ZIP_NAME" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
|
- name: Create Gitea release
|
||||||
|
uses: akkuman/gitea-release-action@v1
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
files: |-
|
||||||
|
${{ env.ZIP_PATH }}
|
||||||
Reference in New Issue
Block a user