diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml index 69d144b..21bb862 100644 --- a/.github/workflows/pr-build.yml +++ b/.github/workflows/pr-build.yml @@ -13,6 +13,8 @@ permissions: jobs: preview: + # Only run for local PRs + if: github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest env: DOTNET_VERSION: 9.0 diff --git a/.github/workflows/pr-version.yml b/.github/workflows/pr-version.yml index af81f92..f49927c 100644 --- a/.github/workflows/pr-version.yml +++ b/.github/workflows/pr-version.yml @@ -12,6 +12,8 @@ permissions: jobs: preview: + # Only run for local PRs + if: github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest steps: @@ -29,12 +31,10 @@ jobs: git fetch --tags || true current=$(git describe --tags --abbrev=0 2>/dev/null || true) if [ -z "$current" ]; then - echo "No tags found, defaulting to v0.0.0" - current="v0.0.0" + echo "No tags found, defaulting to 0.0.0" + current="0.0.0" 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}') @@ -49,7 +49,7 @@ jobs: patch=$((patch+1)); type="patch" fi - next="v${major}.${minor}.${patch}" + next="${major}.${minor}.${patch}" # Safely write outputs if [ -n "$GITHUB_OUTPUT" ]; then diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4c1b814..2055c43 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,12 +41,10 @@ jobs: git fetch --tags || true current=$(git describe --tags --abbrev=0 2>/dev/null || true) if [ -z "$current" ]; then - echo "No tags found, defaulting to v0.0.0" - current="v0.0.0" + echo "No tags found, defaulting to 0.0.0" + current="0.0.0" 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}') @@ -69,6 +67,15 @@ jobs: 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" + - name: Setup NuGet source run: | dotnet nuget add source \ @@ -106,18 +113,10 @@ jobs: mv ${{ env.LAUNCHER_OUTPUT_PATH }}/StarMap.Launcher.exe ${{ env.LAUNCHER_OUTPUT_PATH }}/StarMap.exe mv ${{ env.STANDALONE_OUTPUT_PATH }}/StarMap.Loader.exe ${{ env.STANDALONE_OUTPUT_PATH }}/StarMap.exe - - 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" - name: Upload build artifacts uses: actions/upload-artifact@v4 with: - name: rc-build + name: publish path: | ${{ env.LAUNCHER_OUTPUT_PATH }} ${{ env.STANDALONE_OUTPUT_PATH }} @@ -250,7 +249,7 @@ jobs: uses: actions/download-artifact@v4 with: name: publish - path: publish + path: ./build_artifacts # Install Inno Setup via Chocolatey - name: Install Inno Setup