Skip to content

Commit

Permalink
Update deployment process so that packages can be released independently
Browse files Browse the repository at this point in the history
Untested, but the idea is that versions are still in the Makefile, but now separated per package. Releases are now triggered via tags, e.g. xRetry_v1.9.0 or xRetry.Reqnroll_v1.0.0-alpha1. The tag name prefix is what will trigger the release of that specific package.

Note: the version in the tag is for info only (git history & GH releases). The actual package version deployed will be what is in the makefile, and if it's a Reqnroll or SpecFlow plugin package, the xRetry version they depend on will also be from the Makefile.
  • Loading branch information
JoshKeegan committed Sep 8, 2024
1 parent ca54b1c commit c51c437
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 23 deletions.
19 changes: 15 additions & 4 deletions .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ jobs:
cd:
name: CD
runs-on: ubuntu-latest
container: mcr.microsoft.com/dotnet/sdk:6.0.102-bullseye-slim
container: mcr.microsoft.com/dotnet/sdk:8.0
needs:
- ci_build
- ci_docs
if: github.ref == 'refs/heads/release'
if: github.ref_type == 'tag'
steps:
- name: Download deployment scripts
uses: actions/download-artifact@v4
Expand All @@ -79,6 +79,17 @@ jobs:
name: artefacts
path: artefacts

- name: Release
- name: "Release: xRetry"
if: startsWith(github.ref, 'refs/tags/xRetry_v')
working-directory: deploy
run: /bin/bash deploy.sh ${{ secrets.NUGET_API_KEY }}
run: /bin/bash deploy.sh xRetry ${{ secrets.NUGET_API_KEY }}

- name: "Release: xRetry.SpecFlow"
if: startsWith(github.ref, 'refs/tags/xRetry.SpecFlow_v')
working-directory: deploy
run: /bin/bash deploy.sh xRetry.SpecFlow ${{ secrets.NUGET_API_KEY }}

- name: "Release: xRetry.Reqnroll"
if: startsWith(github.ref, 'refs/tags/xRetry.Reqnroll_v')
working-directory: deploy
run: /bin/bash deploy.sh xRetry.Reqnroll ${{ secrets.NUGET_API_KEY }}
24 changes: 14 additions & 10 deletions build/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
VERSION=1.9.0#
XRETRY_VERSION =1.9.0#
XRETRY_SPECFLOW_VERSION =1.9.0#
XRETRY_REQNOLL_VERSION =1.0.0-alpha1#

.PHONY: clean
clean:
Expand All @@ -19,22 +21,22 @@ build: clean

# SpecFlow & Reqnroll plugins must be built before the tests
cd ../src/xRetry.SpecFlow && \
dotnet build -c Release --no-restore -p:Version=$(VERSION)
dotnet build -c Release --no-restore -p:Version=$(XRETRY_SPECFLOW_VERSION)

cd ../src/xRetry.Reqnroll && \
dotnet build -c Release --no-restore -p:Version=$(VERSION)
dotnet build -c Release --no-restore -p:Version=$(XRETRY_REQNOLL_VERSION)

cd ../test/UnitTests && \
dotnet build -c Release --no-restore -p:Version=$(VERSION)
dotnet build -c Release --no-restore

cd ../test/UnitTests.SingleThreaded && \
dotnet build -c Release --no-restore -p:Version=$(VERSION)
dotnet build -c Release --no-restore

cd ../test/UnitTests.SpecFlow && \
dotnet build -c Release --no-restore -p:Version=$(VERSION)
dotnet build -c Release --no-restore

cd ../test/UnitTests.Reqnroll && \
dotnet build -c Release --no-restore -p:Version=$(VERSION)
dotnet build -c Release --no-restore

.PHONY: unit-tests-run
unit-tests-run:
Expand All @@ -60,21 +62,23 @@ docs:
.PHONY: nuget-create
nuget-create:
dotnet pack ../src/xRetry \
-p:Version=$(VERSION) \
-p:Version=$(XRETRY_VERSION) \
-p:NuspecFile=xRetry.nuspec \
--no-build \
-c Release \
-o ../artefacts/nuget

dotnet pack ../src/xRetry.SpecFlow \
-p:Version=$(VERSION) \
-p:Version=$(XRETRY_SPECFLOW_VERSION) \
-p:xRetryVersion=$(XRETRY_VERSION) \
-p:NuspecFile=xRetry.SpecFlow.nuspec \
--no-build \
-c Release \
-o ../artefacts/nuget

dotnet pack ../src/xRetry.Reqnroll \
-p:Version=$(VERSION) \
-p:Version=$(XRETRY_REQNOLL_VERSION) \
-p:xRetryVersion=$(XRETRY_VERSION) \
-p:NuspecFile=xRetry.Reqnroll.nuspec \
--no-build \
-c Release \
Expand Down
14 changes: 9 additions & 5 deletions deploy/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
#!/bin/bash
set -euxo pipefail

#
# Deploy script
# Args:
# NuGet API Key
#
# - Package name (e.g. xRetry)
# - NuGet API Key

apiKey=$1
package=$1
apiKey=$2

# Must explicitly say there are no symbols for the nuget package, or it will error saying there aren't any accompanying *.snupkg files
dotnet nuget push \
--source https://api.nuget.org/v3/index.json \
--api-key $apiKey \
--no-symbols ../artefacts/nuget/\*.nupkg \
../artefacts/nuget/\*.nupkg
--no-symbols ../artefacts/nuget/$package.\*.nupkg \
../artefacts/nuget/$package.\*.nupkg
2 changes: 1 addition & 1 deletion src/xRetry.Reqnroll/xRetry.Reqnroll.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<AssemblyName>xRetry.ReqnrollPlugin</AssemblyName>

<IsPackable>true</IsPackable>
<NuspecProperties>version=$(Version)</NuspecProperties>
<NuspecProperties>version=$(Version);xRetryVersion=$(xRetryVersion)</NuspecProperties>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/xRetry.Reqnroll/xRetry.Reqnroll.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<dependencies>
<dependency id="Reqnroll.xUnit" version="[2.0.0,3.0.0)" />
<dependency id="xRetry" version="[$version$]" />
<dependency id="xRetry" version="[$xRetryVersion$]" />
</dependencies>
</metadata>

Expand Down
2 changes: 1 addition & 1 deletion src/xRetry.SpecFlow/xRetry.SpecFlow.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<AssemblyName>xRetry.SpecFlowPlugin</AssemblyName>

<IsPackable>true</IsPackable>
<NuspecProperties>version=$(Version)</NuspecProperties>
<NuspecProperties>version=$(Version);xRetryVersion=$(xRetryVersion)</NuspecProperties>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/xRetry.SpecFlow/xRetry.SpecFlow.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<dependencies>
<dependency id="SpecFlow.xUnit" version="[3.9.50,3.10.0)" />
<dependency id="xRetry" version="[$version$]" />
<dependency id="xRetry" version="[$xRetryVersion$]" />
</dependencies>
</metadata>

Expand Down

0 comments on commit c51c437

Please sign in to comment.