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
2 changes: 1 addition & 1 deletion .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
# Re-run the version calculation when labels are added or when new commits are pushed
types: [opened, synchronize, labeled, reopened, edited]
branches: [main, dev]
branches: [main]

permissions:
pull-requests: write
Expand Down
74 changes: 0 additions & 74 deletions .github/workflows/pr-version.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/rc-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Release new RC release

on:
push:
branches: [dev]
branches: [main]

env:
DOTNET_VERSION: 10.0
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/redirect-external-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Redirect external PRs
on:
pull_request_target:
types: [opened, reopened]
branches: [main, dev]
branches: [main]

permissions:
contents: write
Expand All @@ -16,15 +16,15 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Resolve dev branch SHA
id: devsha
- name: Resolve main branch SHA
id: mainsha
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
DEV_SHA=$(gh api repos/${{ github.repository }}/git/ref/heads/dev --jq '.object.sha')
echo "sha=$DEV_SHA" >> $GITHUB_OUTPUT
MAIN_SHA=$(gh api repos/${{ github.repository }}/git/ref/heads/main --jq '.object.sha')
echo "sha=$MAIN_SHA" >> $GITHUB_OUTPUT

- name: Create internal feature branch from dev
- name: Create internal feature branch from main
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand All @@ -34,11 +34,11 @@ jobs:
SAFE_SOURCE_BRANCH=$(echo "$SOURCE_BRANCH" | tr '/' '-')
NEW_BRANCH="feature/external/pr-${PR_NUMBER}-${SAFE_SOURCE_BRANCH}"

echo "Creating branch $NEW_BRANCH from dev"
echo "Creating branch $NEW_BRANCH from main"

gh api repos/${{ github.repository }}/git/refs \
-f ref="refs/heads/$NEW_BRANCH" \
-f sha="${{ steps.devsha.outputs.sha }}"
-f sha="${{ steps.mainsha.outputs.sha }}"

- name: Retarget PR to new branch
env:
Expand Down
85 changes: 35 additions & 50 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: Release new version
name: Release from version tag

on:
pull_request:
types: [closed]
branches: [main]
push:
tags:
- '[0-9]*.[0-9]*.[0-9]*'

permissions:
contents: write

env:
DOTNET_VERSION: 10.0
Expand All @@ -19,7 +22,7 @@ jobs:
outputs:
new_version: ${{ steps.version.outputs.new_version }}
prev_version: ${{ steps.version.outputs.prev_version }}
hash_version: ${{ steps.version.outputs.hash_version }}
release_tag: ${{ steps.version.outputs.release_tag }}
api_changed: ${{ steps.api_check.outputs.api_changed }}
steps:
- uses: actions/checkout@v4
Expand All @@ -31,49 +34,31 @@ jobs:
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Determine version bump
- name: Read version from release tag
id: version
env:
RELEASE_TAG: ${{ github.ref_name }}
run: |
# Be defensive and robust: use awk to split version numbers and always quote $GITHUB_OUTPUT
git fetch --tags || true
current=$(git describe --tags --abbrev=0 2>/dev/null || true)
if [ -z "$current" ]; then
echo "No tags found, defaulting to 0.0.0"
current="0.0.0"
if [[ ! "$RELEASE_TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::error::Release tags must use semantic version format X.Y.Z (for example, 1.2.3)."
exit 1
fi

# Remove leading 'v' then extract parts using awk
ver=${current#v}
major=$(printf "%s" "$ver" | awk -F. '{print $1+0}')
minor=$(printf "%s" "$ver" | awk -F. '{print $2+0}')
patch=$(printf "%s" "$ver" | awk -F. '{print $3+0}')

# Determine bump type from PR labels (safe interpolation)
LABELS="${{ join(github.event.pull_request.labels.*.name, ' ') }}"
if printf "%s" "$LABELS" | grep -q "major"; then
major=$((major+1)); minor=0; patch=0; type="major"
elif printf "%s" "$LABELS" | grep -q "minor"; then
minor=$((minor+1)); patch=0; type="minor"
else
patch=$((patch+1)); type="patch"
previous_tag=""
if git rev-parse --verify "${GITHUB_SHA}^" >/dev/null 2>&1; then
previous_tag=$(git tag --merged "${GITHUB_SHA}^" --format='%(refname:short)' \
| awk '/^[0-9]+\.[0-9]+\.[0-9]+$/ { print }' \
| sort -V \
| tail -n 1)
fi

new_version="${major}.${minor}.${patch}"

echo "Next version: $new_version"
echo "RC version: $hash_version"

echo "prev_version=$current" >> $GITHUB_OUTPUT
echo "new_version=$new_version" >> $GITHUB_OUTPUT

- name: Tag and push new version
run: |
git config user.name "github-actions"
git config user.email "actions@github.com"

NEW_VERSION="${{ steps.version.outputs.new_version }}"
git tag "$NEW_VERSION"
git push origin "$NEW_VERSION"
echo "Release version: $RELEASE_TAG"
echo "Previous release tag: ${previous_tag:-none}"
{
echo "release_tag=$RELEASE_TAG"
echo "new_version=$RELEASE_TAG"
echo "prev_version=$previous_tag"
} >> "$GITHUB_OUTPUT"

- name: Setup NuGet source
run: |
Expand Down Expand Up @@ -107,7 +92,7 @@ jobs:
- name: Check whether StarMap.API changed since previous tag
id: api_check
run: |
current="${{ steps.version.outputs.new_version }}"
current_commit="${GITHUB_SHA}"
prev="${{ steps.version.outputs.prev_version }}"

echo "previous_tag=$prev" >> $GITHUB_OUTPUT
Expand All @@ -118,9 +103,9 @@ jobs:
fi

echo "Previous tag: $prev"
echo "Current commit: $current"
echo "Current commit: $current_commit"

diff=$(git diff --name-only "$prev" "$current")
diff=$(git diff --name-only "$prev" "$current_commit")

{
echo "diff_files<<EOF"
Expand Down Expand Up @@ -204,17 +189,17 @@ jobs:
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.build.outputs.new_version }}
tag_name: ${{ needs.build.outputs.release_tag }}
name: Release ${{ needs.build.outputs.new_version }}
body: |
Automated release for version ${{ needs.build.outputs.new_version }}
Triggered by PR #${{ github.event.pull_request.number }}
Created from tag ${{ needs.build.outputs.release_tag }} at commit ${{ github.sha }}
files: |
StarMap-${{ needs.build.outputs.new_version }}.zip

build-release-installer:
runs-on: windows-latest
needs: build
needs: [build, release-zip]
steps:
- uses: actions/checkout@v4

Expand All @@ -223,7 +208,7 @@ jobs:
uses: actions/download-artifact@v4
with:
name: publish
path: ./build_artifacts
path: .

# Install Inno Setup via Chocolatey
- name: Install Inno Setup
Expand All @@ -238,5 +223,5 @@ jobs:
- name: Attach installer to GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.build.outputs.new_version }}
tag_name: ${{ needs.build.outputs.release_tag }}
files: installer/dist/StarMap-${{ needs.build.outputs.new_version }}.exe
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ A POC/Prototype arbitrary code modloader for Kitten Space Agency.
Currently this loader can be ran with this functionality in the background, or as a dumb loader just loading mods.
It makes use of Assembly Load Contexts to ensure mod dependencies are managed seperatly, reducing conflicts

## Releases

To publish a release, create and push a semantic-version tag such as `1.2.3` on the commit to release. The release workflow builds the release and installer from that commit; tags can point to commits on any branch.

## Installation

- Download and unzip release from [Releases](https://github.com/StarMapLoader/StarMap/releases/latest).
- Install the [.NET 10 Runtime](https://dotnet.microsoft.com/en-us/download/dotnet/10.0) for Windows x64 if it is not already installed.
- Run StarMap.exe, this will fail and create a StarMapConfig.json.
- Open StarMapConfig.json and set the location of your KSA installation.
- `GameLocation` should be set to the location where Kitten Space Agency was installed, pointing directly to that folder (e.g. `C:\\games\\Kitten Space Agency\\`)
Expand Down
Loading