Skip to content

Update dotnet monorepo (#48) #24

Update dotnet monorepo (#48)

Update dotnet monorepo (#48) #24

Workflow file for this run

name: CD
on:
push:
branches:
- 'release/**'
jobs:
build:
env:
BUILD_CONFIG: 'Release'
SOLUTION: 'Aspire.Hosting.Krakend.sln'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Docker log in
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ${{secrets.CONTAINER_REGISTRY}}
username: ${{secrets.CONTAINER_REGISTRY_USERNAME}}
password: ${{secrets.CONTAINER_REGISTRY_PASSWORD}}
- name: Setup .NET
uses: actions/setup-dotnet@87b7050bc53ea08284295505d98d2aa94301e852 # v4
with:
dotnet-version: '9.0.x'
- name: Get Build Version
run: |
echo "GITHUB_REF=$GITHUB_REF"
branch_name=${GITHUB_REF#refs/heads/}
version=$(./build/GetBuildVersion.sh ${branch_name#*/})
echo "BUILD_VERSION=$version" >> $GITHUB_ENV
shell: bash
- name: Build
run: dotnet build $SOLUTION --configuration $BUILD_CONFIG /p:ContinuousIntegrationBuild=true -p:Version=$BUILD_VERSION
- name: Test
run: dotnet test --configuration $BUILD_CONFIG --no-restore --no-build --verbosity normal
- name: Publish Proxy Container
if: startsWith(github.ref, 'refs/heads/release')
id: publish-container
shell: bash
run: |
dotnet publish ./NapalmCodes.Aspire.Hosting.Krakend.Proxy \
--arch x64 \
--os linux \
-p:PublishProfile=DefaultContainer \
-p:ContainerImageTags=$BUILD_VERSION
- name: Publish Nuget
if: startsWith(github.ref, 'refs/heads/release')
run: |
dotnet nuget push **/*.nupkg --source 'https://api.nuget.org/v3/index.json' --api-key ${{secrets.NUGET_API_KEY}}