Skip to content

Commit

Permalink
chore(sdk-dotnet): Auto version release (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnjcsmith authored Nov 3, 2024
1 parent 66de065 commit 80170d7
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
37 changes: 35 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
run: |
npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
version=$(npx release-it --release-version)
npx release-it --npm.skipChecks --git.tagName=sdk-node/${version} --no-github.release
npx release-it --npm.skipChecks --git.tagName=sdk-node/${version} --no-github.release --git.commitMessage="Bump sdk-node version to ${version}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand All @@ -92,18 +92,51 @@ jobs:
dotnet-version: "8.0.x"
- name: Restore dependencies
run: dotnet restore
- name: Get and Increment Version
id: increment_version
shell: pwsh
run: |
$xmlPath = ".\*.csproj"
$xml = [xml](Get-Content $xmlPath)
$currentVersion = $xml.Project.PropertyGroup.Version
if (-not $currentVersion) {
throw "Version element not found in project file"
}
# Parse version components
$major, $minor, $patch = $currentVersion.Split('.')
$newPatch = [int]$patch + 1
$newVersion = "$major.$minor.$newPatch"
# Update project file
$xml.Project.PropertyGroup.Version = $newVersion
$xml.Save($xmlPath)
# Set output for later steps
echo "new_version=$newVersion" >> $GITHUB_OUTPUT
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Pack
run: dotnet pack --configuration Release --no-restore --output ./output
# TODO: Auto version bump
- name: Setup NuGet
uses: nuget/setup-nuget@v1
with:
nuget-api-key: ${{ secrets.NUGET_API_KEY }}
nuget-version: latest
- name: Publish
run: dotnet nuget push output\*.nupkg -s https://api.nuget.org/v3/index.json
- name: Commit and push changes
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add inferable.go
git commit -m "Bump sdk-dotnet version to ${{ steps.increment_version.outputs.new_version }}"
git push
- name: Create Git tag
run: |
git tag sdk-dotnet/v${{ steps.increment_version.outputs.new_version }}
git push origin sdk-dotnet/v${{ steps.increment_version.outputs.new_version }}
publish-go:
needs: check_changes
Expand Down
2 changes: 1 addition & 1 deletion sdk-dotnet/src/Inferable.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>

<PackageId>Inferable</PackageId>
<Version>0.0.14</Version>
<Version>0.0.15</Version>
<Authors>Inferable</Authors>
<Company>Inferable</Company>
<Description>Client library for interacting with the Inferable API</Description>
Expand Down

0 comments on commit 80170d7

Please sign in to comment.