Skip to content

Release

Release #154

Workflow file for this run

name: Publish to NuGet and Version Bump
on:
workflow_dispatch:
permissions:
contents: write
jobs:
publish:
name: build, pack & publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.AUTOMATION_USER_TOKEN }}
fetch-depth: 0
- name: Set Git User Config
run: |
git config --global user.email "[email protected]"
git config --global user.name "DevCycle Automation"
- name: Install xq
run: |
curl -sSL https://bit.ly/install-xq | sudo bash
- name: Get current version of Cloud SDK
id: cloud-version
run: echo "version=$(xq -x //Project/PropertyGroup/PackageVersion DevCycle.SDK.Server.Cloud/DevCycle.SDK.Server.Cloud.csproj)" >> "$GITHUB_OUTPUT"
- name: Get current version of Common Library
id: common-version
run: echo "version=$(xq -x //Project/PropertyGroup/PackageVersion DevCycle.SDK.Server.Common/DevCycle.SDK.Server.Common.csproj)" >> "$GITHUB_OUTPUT"
- name: Get current version of Local SDK
id: local-version
run: echo "version=$(xq -x //Project/PropertyGroup/PackageVersion DevCycle.SDK.Server.Local/DevCycle.SDK.Server.Local.csproj)" >> "$GITHUB_OUTPUT"
- name: Bump Cloud Version
id: semverbump-cloud
uses: WyriHaximus/[email protected]
with:
version: ${{ steps.cloud-version.outputs.version }}
- name: Bump Common Version
id: semverbump-common
uses: WyriHaximus/[email protected]
with:
version: ${{ steps.common-version.outputs.version }}
- name: Bump Local Version
id: semverbump-local
uses: WyriHaximus/[email protected]
with:
version: ${{ steps.local-version.outputs.version }}
- name: Replace the versions for all SDKs
run: |
sed -E -i "s|<(.*)Version>[0-9]+\.[0-9]+\.[0-9]|<\1Version>${{ steps.semverbump-cloud.outputs.patch }}|g" DevCycle.SDK.Server.Cloud/DevCycle.SDK.Server.Cloud.csproj
sed -E -i "s|<(.*)Version>[0-9]+\.[0-9]+\.[0-9]|<\1Version>${{ steps.semverbump-common.outputs.patch }}|g" DevCycle.SDK.Server.Common/DevCycle.SDK.Server.Common.csproj
sed -E -i "s|<(.*)Version>[0-9]+\.[0-9]+\.[0-9]|<\1Version>${{ steps.semverbump-local.outputs.patch }}|g" DevCycle.SDK.Server.Local/DevCycle.SDK.Server.Local.csproj
git add .
git commit -m "Version Bumping"
git push -u origin main
- name: Package
run: dotnet build -c Release
- name: Publish Local to NuGet
run: dotnet nuget push DevCycle.SDK.Server.Local/bin/Release/DevCycle.SDK.Server.Local.*.nupkg -k ${{secrets.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json --skip-duplicate
- name: Publish Cloud to NuGet
run: dotnet nuget push DevCycle.SDK.Server.Cloud/bin/Release/DevCycle.SDK.Server.Cloud.*.nupkg -k ${{secrets.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json --skip-duplicate
- name: Publish Common to NuGet
run: dotnet nuget push DevCycle.SDK.Server.Common/bin/Release/DevCycle.SDK.Server.Common.*.nupkg -k ${{secrets.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json --skip-duplicate
# Release action doesn't work right now for this repo due to the multiple different project versions
# - name: Create GitHub Release
# uses: DevCycleHQ/release-action/gh-release@v2
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}