Skip to content

Commit 0ef4388

Browse files
authored
Merge pull request #59 from StarMapLoader/dev
Release 0.4.0
2 parents 69c97c0 + 21dcef7 commit 0ef4388

41 files changed

Lines changed: 1151 additions & 696 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/pr-build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
env:
1818
DOTNET_VERSION: 9.0
19-
PROJECT: StarMapLoader/StarMapLoader.csproj
19+
PROJECT: StarMap.Launcher/StarMap.Launcher.csproj
2020
NUGET_SOURCE: "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
2121

2222
steps:
@@ -33,8 +33,8 @@ jobs:
3333
dotnet nuget add source --username "${{ secrets.ORG_PACKAGE_USERNAME }}" --password "${{ secrets.ORG_PACKAGE_TOKEN }}" --store-password-in-clear-text --name github "${{ env.NUGET_SOURCE }}"
3434
dotnet restore ${{ env.PROJECT }}
3535
36-
# - name: Run tests
37-
# run: dotnet test --no-build --verbosity normal
38-
3936
- name: Build
4037
run: dotnet build ${{ env.PROJECT }} -c Release
38+
39+
# - name: Run tests
40+
# run: dotnet test --no-build --verbosity normal

.github/workflows/rc-build.yml

Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
name: Release new version
2+
3+
on:
4+
push:
5+
branches: [dev]
6+
7+
env:
8+
DOTNET_VERSION: 10.0
9+
STANDALONE_PROJECT: StarMap.Loader/StarMap.Loader.csproj
10+
LAUNCHER_PROJECT: StarMap.Launcher/StarMap.Launcher.csproj
11+
API_PROJECT: StarMap.API/StarMap.API.csproj
12+
STANDALONE_OUTPUT_PATH: ./publish/standalone
13+
LAUNCHER_OUTPUT_PATH: ./publish/launcher
14+
OUTPUT_PATH: ./publish
15+
NUGET_SOURCE: "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
16+
EXCLUDE: "*.pdb *.xml"
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
outputs:
22+
new_version: ${{ steps.version.outputs.new_version }}
23+
prev_version: ${{ steps.version.outputs.prev_version }}
24+
hash_version: ${{ steps.version.outputs.hash_version }}
25+
steps:
26+
- uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
29+
fetch-tags: true
30+
31+
- uses: actions/setup-dotnet@v4
32+
with:
33+
dotnet-version: ${{ env.DOTNET_VERSION }}
34+
35+
- name: Determine version bump
36+
id: version
37+
run: |
38+
git fetch --tags --force || true
39+
40+
# Find latest semantic version
41+
current=$(git tag -l '[0-9]*.[0-9]*.[0-9]*' | sort -V | tail -n 1)
42+
if [ -z "$current" ]; then
43+
current="0.0.0"
44+
fi
45+
echo "Latest semantic tag: $current"
46+
47+
ver=${current#v}
48+
major=$(printf "%s" "$ver" | awk -F. '{print $1+0}')
49+
minor=$(printf "%s" "$ver" | awk -F. '{print $2+0}')
50+
patch=$(printf "%s" "$ver" | awk -F. '{print $3+0}')
51+
52+
patch=$((patch+1))
53+
new_version="${major}.${minor}.${patch}"
54+
55+
# Truly unique RC version
56+
hash_version="${new_version}-rc.${GITHUB_RUN_NUMBER}+${GITHUB_SHA::7}"
57+
58+
echo "Next version: $new_version"
59+
echo "RC version: $hash_version"
60+
61+
echo "prev_version=$current" >> $GITHUB_OUTPUT
62+
echo "new_version=$new_version" >> $GITHUB_OUTPUT
63+
echo "hash_version=$hash_version" >> $GITHUB_OUTPUT
64+
65+
- name: Setup NuGet source
66+
run: |
67+
dotnet nuget add source \
68+
--username ${{ secrets.ORG_PACKAGE_USERNAME }} \
69+
--password ${{ secrets.ORG_PACKAGE_TOKEN }} \
70+
--store-password-in-clear-text \
71+
--name github "${{ env.NUGET_SOURCE }}"
72+
73+
- name: Build launcher
74+
run: |
75+
dotnet publish ${{ env.LAUNCHER_PROJECT }} \
76+
-c Release \
77+
-o ${{ env.LAUNCHER_OUTPUT_PATH }} \
78+
-r win-x64 \
79+
--self-contained false \
80+
/p:PackageVersion=${{ steps.version.outputs.hash_version }} \
81+
/p:Version=${{ steps.version.outputs.new_version }} \
82+
/p:AssemblyVersion=${{ steps.version.outputs.new_version }} \
83+
/p:FileVersion=${{ steps.version.outputs.new_version }}
84+
85+
- name: Build standalone
86+
run: |
87+
dotnet publish ${{ env.STANDALONE_PROJECT }} \
88+
-c Release \
89+
-o ${{ env.STANDALONE_OUTPUT_PATH }} \
90+
-r win-x64 \
91+
--self-contained false \
92+
/p:PackageVersion=${{ steps.version.outputs.hash_version }} \
93+
/p:Version=${{ steps.version.outputs.new_version }} \
94+
/p:AssemblyVersion=${{ steps.version.outputs.new_version }} \
95+
/p:FileVersion=${{ steps.version.outputs.new_version }}
96+
97+
- name: Rename executables
98+
run: |
99+
mv ${{ env.LAUNCHER_OUTPUT_PATH }}/StarMap.Launcher.exe ${{ env.LAUNCHER_OUTPUT_PATH }}/StarMap.exe
100+
mv ${{ env.STANDALONE_OUTPUT_PATH }}/StarMap.Loader.exe ${{ env.STANDALONE_OUTPUT_PATH }}/StarMap.exe
101+
102+
- name: Write version file
103+
run: echo "${{ steps.version.outputs.hash_version }}" > version.txt
104+
105+
- name: Upload build artifacts
106+
uses: actions/upload-artifact@v4
107+
with:
108+
name: rc-build
109+
path: |
110+
${{ env.LAUNCHER_OUTPUT_PATH }}
111+
${{ env.STANDALONE_OUTPUT_PATH }}
112+
version.txt
113+
retention-days: 1
114+
115+
publish-RC-nuget:
116+
runs-on: ubuntu-latest
117+
needs: build
118+
steps:
119+
- uses: actions/checkout@v4
120+
with:
121+
fetch-depth: 0
122+
123+
- uses: actions/setup-dotnet@v4
124+
with:
125+
dotnet-version: ${{ env.DOTNET_VERSION }}
126+
127+
- name: Download build artifacts
128+
uses: actions/download-artifact@v4
129+
with:
130+
name: rc-build
131+
path: ./build_artifacts
132+
133+
- name: Setup NuGet source
134+
run: |
135+
dotnet nuget add source \
136+
--username ${{ secrets.ORG_PACKAGE_USERNAME }} \
137+
--password ${{ secrets.ORG_PACKAGE_TOKEN }} \
138+
--store-password-in-clear-text \
139+
--name github "${{ env.NUGET_SOURCE }}"
140+
141+
- name: Pack and push RC NuGet package
142+
run: |
143+
dotnet restore ${{ env.API_PROJECT }}
144+
dotnet pack ${{ env.API_PROJECT }} \
145+
-c Release \
146+
-o ./nupkg \
147+
/p:PackageVersion=${{ needs.build.outputs.hash_version }} \
148+
/p:Version=${{ needs.build.outputs.new_version }} \
149+
/p:InformationalVersion=${{ needs.build.outputs.hash_version }}
150+
dotnet nuget push ./nupkg/*.nupkg \
151+
--source github \
152+
--api-key "${{ secrets.GITHUB_TOKEN }}" \
153+
--skip-duplicate
154+
155+
release-RC-zip:
156+
runs-on: ubuntu-latest
157+
needs: build
158+
steps:
159+
- uses: actions/checkout@v4
160+
with:
161+
fetch-depth: 0
162+
163+
- name: Download build artifacts
164+
uses: actions/download-artifact@v4
165+
with:
166+
name: rc-build
167+
path: ./build_artifacts
168+
169+
- name: Ensure zip is available
170+
run: |
171+
sudo apt-get update -y
172+
sudo apt-get install -y zip
173+
174+
- name: Package launcher ZIP
175+
run: |
176+
cd ./build_artifacts/${{ env.LAUNCHER_OUTPUT_PATH }}
177+
zip -r $GITHUB_WORKSPACE/StarMapLauncher-RC.zip . -x ${{ env.EXCLUDE }}
178+
cd -
179+
180+
- name: Package standalone ZIP
181+
run: |
182+
cd ./build_artifacts/${{ env.STANDALONE_OUTPUT_PATH }}
183+
zip -r $GITHUB_WORKSPACE/StarMapStandalone-RC.zip . -x ${{ env.EXCLUDE }}
184+
cd -
185+
186+
- name: Update RC GitHub release
187+
uses: softprops/action-gh-release@v1
188+
with:
189+
tag_name: rc
190+
name: Release Candidate
191+
prerelease: true
192+
files: |
193+
StarMapLauncher-RC.zip
194+
StarMapStandalone-RC.zip
195+
./build_artifacts/version.txt
196+
env:
197+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
198+
199+
- name: Update RC tag
200+
run: |
201+
git tag -f rc
202+
git push origin rc --force
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Redirect external PRs
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, reopened]
6+
branches: [main, dev]
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
redirect:
14+
# Only run for PRs coming from forks
15+
if: github.event.pull_request.head.repo.full_name != github.repository
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Resolve dev branch SHA
20+
id: devsha
21+
env:
22+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
run: |
24+
DEV_SHA=$(gh api repos/${{ github.repository }}/git/ref/heads/dev --jq '.object.sha')
25+
echo "sha=$DEV_SHA" >> $GITHUB_OUTPUT
26+
27+
- name: Create internal feature branch from dev
28+
env:
29+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
run: |
31+
PR_NUMBER="${{ github.event.pull_request.number }}"
32+
SOURCE_BRANCH="${{ github.event.pull_request.head.ref }}"
33+
34+
SAFE_SOURCE_BRANCH=$(echo "$SOURCE_BRANCH" | tr '/' '-')
35+
NEW_BRANCH="feature/external/pr-${PR_NUMBER}-${SAFE_SOURCE_BRANCH}"
36+
37+
echo "Creating branch $NEW_BRANCH from dev"
38+
39+
gh api repos/${{ github.repository }}/git/refs \
40+
-f ref="refs/heads/$NEW_BRANCH" \
41+
-f sha="${{ steps.devsha.outputs.sha }}"
42+
43+
- name: Retarget PR to new branch
44+
env:
45+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
run: |
47+
PR_NUMBER="${{ github.event.pull_request.number }}"
48+
SOURCE_BRANCH="${{ github.event.pull_request.head.ref }}"
49+
50+
SAFE_SOURCE_BRANCH=$(echo "$SOURCE_BRANCH" | tr '/' '-')
51+
NEW_BRANCH="feature/external/pr-${PR_NUMBER}-${SAFE_SOURCE_BRANCH}"
52+
53+
echo "Updating PR #$PR_NUMBER base to $NEW_BRANCH"
54+
55+
gh api repos/${{ github.repository }}/pulls/$PR_NUMBER \
56+
-X PATCH \
57+
-f base="$NEW_BRANCH"

0 commit comments

Comments
 (0)