Skip to content

Bump the nuget-dependencies group with 1 update #257

Bump the nuget-dependencies group with 1 update

Bump the nuget-dependencies group with 1 update #257

on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
types: [opened, reopened, synchronize]
workflow_call:
workflow_dispatch:
name: build-module-base
env:
DOTNET_VERSION: 10.0.x
REGISTRY: ghcr.io
jobs:
check-host-deps:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Check host dependency list is in sync
run: bash scripts/sync-host-deps.sh
build:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup .NET SDK ${{ env.DOTNET_VERSION }}
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Cache NuGet packages
uses: actions/cache@v5
with:
path: ~/.nuget/packages
key: module-base-nuget
restore-keys: |
module-base-nuget-
- name: Determine version
id: version
run: |
# Read base version from Directory.Build.props
BASE_VERSION=$(grep -oP '(?<=<Version>)[^<]+' Directory.Build.props)
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
# Tagged release: use tag as version
TAG="${GITHUB_REF#refs/tags/}"
echo "package_version=$TAG" >> "$GITHUB_OUTPUT"
echo "is_release=true" >> "$GITHUB_OUTPUT"
else
# Dev build: append pre-release suffix
echo "package_version=${BASE_VERSION}-dev.${GITHUB_RUN_NUMBER}" >> "$GITHUB_OUTPUT"
echo "is_release=false" >> "$GITHUB_OUTPUT"
fi
- name: Build and Pack ModuleBase
run: dotnet build ModuleBase/ModuleBase.csproj -c Release -o ./publish/ModuleBase -p:PackageVersion=${{ steps.version.outputs.package_version }}
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: OpenShock Desktop Module Base
path: ./publish/ModuleBase/**
retention-days: 1
if-no-files-found: error
publish-github:
needs: [check-host-deps, build]
if: github.event_name == 'push'
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
packages: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v8
with:
name: OpenShock Desktop Module Base
path: ./packages
- name: Push to GitHub Packages
run: dotnet nuget push "./packages/*.nupkg" --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
publish-nuget:
needs: [check-host-deps, build]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
id-token: write
steps:
- name: Setup .NET SDK ${{ env.DOTNET_VERSION }}
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Download artifacts
uses: actions/download-artifact@v8
with:
name: OpenShock Desktop Module Base
path: ./packages
- name: Login to NuGet.org with trusted publishing
uses: NuGet/login@v1
id: nuget-login
with:
user: ${{ secrets.NUGET_USER }}
- name: Push to NuGet.org
run: dotnet nuget push "./packages/*.nupkg" --source "https://api.nuget.org/v3/index.json" --api-key ${{ steps.nuget-login.outputs.NUGET_API_KEY }} --skip-duplicate