-
Notifications
You must be signed in to change notification settings - Fork 1
93 lines (92 loc) · 5.12 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Release
on:
workflow_dispatch:
inputs:
version-increment-type:
description: "Which part of the version to increment:"
required: true
type: choice
options:
- major
- minor
- patch
default: "patch"
permissions:
contents: write
id-token: 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 Secrets
uses: DevCycleHQ/aws-secrets-action@main
with:
secrets_map: '{"NUGET_API_KEY": "DEVCYCLE_GITHUB_dotnet-server-sdk_NUGET_API_KEY"}'
aws_account_id: '134377926370'
- 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 (major)
if: ${{ github.event.inputs.version-increment-type == 'major' }}
run: |
sed -E -i "s|<(.*)Version>[0-9]+\.[0-9]+\.[0-9]|<\1Version>${{ steps.semverbump-cloud.outputs.major }}|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.major }}|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.major }}|g" DevCycle.SDK.Server.Local/DevCycle.SDK.Server.Local.csproj
- name: Replace the versions for all SDKs (minor)
if: ${{ github.event.inputs.version-increment-type == 'minor' }}
run: |
sed -E -i "s|<(.*)Version>[0-9]+\.[0-9]+\.[0-9]|<\1Version>${{ steps.semverbump-cloud.outputs.minor }}|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.minor }}|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.minor }}|g" DevCycle.SDK.Server.Local/DevCycle.SDK.Server.Local.csproj
- name: Replace the versions for all SDKs (patch)
if: ${{ github.event.inputs.version-increment-type == 'patch' }}
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
- name: Commit and Push Version Bumps
run: |
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 ${{env.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 ${{env.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 ${{env.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json --skip-duplicate