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
8 changes: 4 additions & 4 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
env:
DOTNET_VERSION: 9.0
PROJECT: StarMapLoader/StarMapLoader.csproj
PROJECT: StarMap.Launcher/StarMap.Launcher.csproj
NUGET_SOURCE: "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"

steps:
Expand All @@ -33,8 +33,8 @@ jobs:
dotnet nuget add source --username "${{ secrets.ORG_PACKAGE_USERNAME }}" --password "${{ secrets.ORG_PACKAGE_TOKEN }}" --store-password-in-clear-text --name github "${{ env.NUGET_SOURCE }}"
dotnet restore ${{ env.PROJECT }}

# - name: Run tests
# run: dotnet test --no-build --verbosity normal

- name: Build
run: dotnet build ${{ env.PROJECT }} -c Release

# - name: Run tests
# run: dotnet test --no-build --verbosity normal
198 changes: 198 additions & 0 deletions .github/workflows/rc-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
name: Release new version

on:
push:
branches: [dev]

env:
DOTNET_VERSION: 10.0
STANDALONE_PROJECT: StarMap.Loader/StarMap.Loader.csproj
LAUNCHER_PROJECT: StarMap.Launcher/StarMap.Launcher.csproj
API_PROJECT: StarMap.API/StarMap.API.csproj
STANDALONE_OUTPUT_PATH: ./publish/standalone
LAUNCHER_OUTPUT_PATH: ./publish/launcher
OUTPUT_PATH: ./publish
NUGET_SOURCE: "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
EXCLUDE: "*.pdb *.xml"

jobs:
build:
runs-on: ubuntu-latest
outputs:
new_version: ${{ steps.version.outputs.new_version }}
prev_version: ${{ steps.version.outputs.prev_version }}
hash_version: ${{ steps.version.outputs.hash_version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Determine version bump
id: version
run: |
git fetch --tags --force || true

# Find latest semantic version
current=$(git tag -l '[0-9]*.[0-9]*.[0-9]*' | sort -V | tail -n 1)
if [ -z "$current" ]; then
current="0.0.0"
fi
echo "Latest semantic tag: $current"

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}')

patch=$((patch+1))
new_version="${major}.${minor}.${patch}"

# Truly unique RC version
hash_version="${new_version}-rc.${GITHUB_RUN_NUMBER}+${GITHUB_SHA::7}"

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

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

- name: Setup NuGet source
run: |
dotnet nuget add source \
--username ${{ secrets.ORG_PACKAGE_USERNAME }} \
--password ${{ secrets.ORG_PACKAGE_TOKEN }} \
--store-password-in-clear-text \
--name github "${{ env.NUGET_SOURCE }}"

- name: Build launcher
run: |
dotnet publish ${{ env.LAUNCHER_PROJECT }} \
-c Release \
-o ${{ env.LAUNCHER_OUTPUT_PATH }} \
-r win-x64 \
--self-contained false \
/p:PackageVersion=${{ steps.version.outputs.hash_version }} \
/p:Version=${{ steps.version.outputs.new_version }} \
/p:AssemblyVersion=${{ steps.version.outputs.new_version }} \
/p:FileVersion=${{ steps.version.outputs.new_version }}

- name: Build standalone
run: |
dotnet publish ${{ env.STANDALONE_PROJECT }} \
-c Release \
-o ${{ env.STANDALONE_OUTPUT_PATH }} \
-r win-x64 \
--self-contained false \
/p:PackageVersion=${{ steps.version.outputs.hash_version }} \
/p:Version=${{ steps.version.outputs.new_version }} \
/p:AssemblyVersion=${{ steps.version.outputs.new_version }} \
/p:FileVersion=${{ steps.version.outputs.new_version }}

- name: Rename executables
run: |
mv ${{ env.LAUNCHER_OUTPUT_PATH }}/MyProgram.Launcher.exe ${{ env.LAUNCHER_OUTPUT_PATH }}/MyProgram.exe
mv ${{ env.STANDALONE_OUTPUT_PATH }}/MyProgram.exe ${{ env.STANDALONE_OUTPUT_PATH }}/MyProgram.exe

- name: Write version file
run: echo "${{ steps.version.outputs.hash_version }}" > version.txt

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: rc-build
path: |
${{ env.LAUNCHER_OUTPUT_PATH }}
${{ env.STANDALONE_OUTPUT_PATH }}
version.txt
retention-days: 1

publish-RC-nuget:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: rc-build
path: ./build_artifacts

- name: Pack and push RC NuGet package
run: |
dotnet restore ${{ env.API_PROJECT }}
dotnet pack ${{ env.API_PROJECT }} \
-c Release \
-o ./nupkg \
/p:PackageVersion=${{ needs.build.outputs.hash_version }} \
/p:Version=${{ needs.build.outputs.new_version }} \
/p:InformationalVersion=${{ needs.build.outputs.hash_version }}
dotnet nuget add source --username "${{ github.actor }}" \
--password "${{ secrets.GITHUB_TOKEN }}" \
--store-password-in-clear-text \
--name github "${{ env.NUGET_SOURCE }}"
dotnet nuget push ./nupkg/*.nupkg \
--source github \
--api-key "${{ secrets.GITHUB_TOKEN }}" \
--skip-duplicate

release-RC-zip:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: rc-build
path: ./build_artifacts

- name: Ensure zip is available
run: |
sudo apt-get update -y
sudo apt-get install -y zip

- name: Package launcher ZIP
run: |
cd ./build_artifacts/${{ env.LAUNCHER_OUTPUT_PATH }}
zip -r $GITHUB_WORKSPACE/StarMapLauncher-RC.zip . -x ${{ env.EXCLUDE }}
cd -

- name: Package standalone ZIP
run: |
cd ./build_artifacts/${{ env.STANDALONE_OUTPUT_PATH }}
zip -r $GITHUB_WORKSPACE/StarMapStandalone-RC.zip . -x ${{ env.EXCLUDE }}
cd -

- name: Update RC GitHub release
uses: softprops/action-gh-release@v1
with:
tag_name: rc
name: Release Candidate
prerelease: true
files: |
StarMapLauncher-RC.zip
StarMapStandalone-RC.zip
./build_artifacts/version.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Update RC tag
run: |
git tag -f rc
git push origin rc --force
86 changes: 57 additions & 29 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ jobs:
packages: write
env:
DOTNET_VERSION: 9.0
PROJECT: StarMapLoader/StarMapLoader.csproj
STANDALONE_PROJECT: StarMap.Loader/StarMap.Loader.csproj
LAUNCHER_PROJECT: StarMap.Launcher/StarMap.Launcher.csproj
STANDALONE_OUTPUT_PATH: ./publish/standalone
LAUNCHER_OUTPUT_PATH: ./publish/launcher
OUTPUT_PATH: ./publish
NUGET_SOURCE: "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
EXCLUDE: "*.pdb *.xml"
Expand Down Expand Up @@ -65,15 +68,6 @@ jobs:
echo "type=$bump_type" >> $GITHUB_OUTPUT
echo "new=$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 }}"
git tag "$NEW_VERSION"
git push origin "$NEW_VERSION"

- name: Setup Github NuGet
run: |
dotnet nuget add source \
Expand All @@ -82,29 +76,27 @@ jobs:
--store-password-in-clear-text \
--name github "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"

- name: Build
run: dotnet publish ${{ env.PROJECT }} -c Release -o ${{ env.OUTPUT_PATH }} -r win-x64 --self-contained false
- name: Build launcher
run: dotnet publish ${{ env.LAUNCHER_PROJECT }}
-c Release -o ${{ env.LAUNCHER_OUTPUT_PATH }}
-r win-x64
--self-contained false
/p:PackageVersion=${{ steps.version.outputs.new }} \
/p:Version=${{ steps.version.outputs.new }} \
/p:AssemblyVersion=${{ steps.version.outputs.new }} \
/p:FileVersion=${{ steps.version.outputs.new }}

- name: Ensure zip is available
run: |
sudo apt-get update -y
sudo apt-get install -y zip
# - name: Run tests
# run: dotnet test --no-build --verbosity normal

- name: Package ZIP
- name: Tag and push new version
run: |
cd ${{ env.OUTPUT_PATH }}
zip -r $GITHUB_WORKSPACE/StarMap-${{ steps.version.outputs.new }}.zip . -x ${{ env.EXCLUDE }}
cd -
git config user.name "github-actions"
git config user.email "actions@github.com"

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.new }}
name: Release ${{ steps.version.outputs.new }}
body: |
Automated release for version ${{ steps.version.outputs.new }}
Triggered by PR #${{ github.event.pull_request.number }}
files: StarMap-${{ steps.version.outputs.new }}.zip
NEW_VERSION="${{ steps.version.outputs.new }}"
git tag "$NEW_VERSION"
git push origin "$NEW_VERSION"

- name: Check whether StarMap.API changed since previous tag
id: api_check
Expand Down Expand Up @@ -152,6 +144,42 @@ jobs:
--api-key "${{ secrets.NUGET_API_KEY }}" \
--skip-duplicate

- name: Build standalone
run: dotnet publish ${{ env.STANDALONE_PROJECT }}
-c Release -o ${{ env.STANDALONE_OUTPUT_PATH }}
-r win-x64
--self-contained false
/p:PackageVersion=${{ steps.version.outputs.new }} \
/p:Version=${{ steps.version.outputs.new }} \
/p:AssemblyVersion=${{ steps.version.outputs.new }} \
/p:FileVersion=${{ steps.version.outputs.new }}

- name: Rename executables
run: |
ren publish\launcher\MyProgram.Launcher.exe MyProgram.exe
ren publish\launcher\MyProgram.Launcher.exe MyProgram.exe

- name: Ensure zip is available
run: |
sudo apt-get update -y
sudo apt-get install -y zip

- name: Package launcher ZIP
run: |
cd ${{ env.LAUNCHER_OUTPUT_PATH }}
zip -r $GITHUB_WORKSPACE/StarMapLauncher-${{ steps.version.outputs.new }}.zip . -x ${{ env.EXCLUDE }}
cd -

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.new }}
name: Release ${{ steps.version.outputs.new }}
body: |
Automated release for version ${{ steps.version.outputs.new }}
Triggered by PR #${{ github.event.pull_request.number }}
files: StarMap-${{ steps.version.outputs.new }}.zip

- name: Upload publish folder for Windows installer
uses: actions/upload-artifact@v4
with:
Expand Down
15 changes: 0 additions & 15 deletions DummyProgram/DummyProgram.csproj

This file was deleted.

21 changes: 0 additions & 21 deletions DummyProgram/Mod.cs

This file was deleted.

Loading
Loading