Skip to content

Commit

Permalink
update nuget action to require approval and set specific suffix depen…
Browse files Browse the repository at this point in the history
…ding on pr or push
  • Loading branch information
RaidMax committed Jun 29, 2024
1 parent 63e1f31 commit bcad270
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 13 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build_application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ on:
branches: [ develop ]
paths:
- Application/**
- WebfrontCore/**
- Data/**
- SharedLibraryCore/**
- Plugins/**

env:
releaseType: prerelease
Expand Down
44 changes: 31 additions & 13 deletions .github/workflows/shared_library_nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ name: SharedLibraryCore NuGet

on:
push:
branches: [ develop ]
branches: [ develop, release/pre, master ]
paths:
- SharedLibraryCore/**
- Data/**
- .github/workflows/shared_library_nuget.yml
pull_request:
branches: [ develop ]
paths:
- SharedLibraryCore/**
- Data/**

env:
outputDirectory: ${{ github.workspace}}/nuget
buildConfiguration: Prerelease

jobs:
build_pack:
make_version:
runs-on: ubuntu-latest

outputs:
build_num: ${{ steps.generate_build_number.outputs.build_num }}

Expand All @@ -27,38 +27,56 @@ jobs:
id: generate_build_number
run: |
build_num=$(date +'%Y.%-m.%-d').$(date +'%3N' | sed 's/^0*//')
echo "build_num=$build_num" >> $GITHUB_ENV
echo "build_num=$build_num" >> $GITHUB_OUTPUT
echo "Build number is $build_num"
build_pack:
runs-on: ubuntu-latest
needs: [ make_version ]

env:
buildNumber: ${{ needs.make_version.outputs.build_num }}
packageTag: ${{ github.event_name == 'pull_request' && -beta || -preview }}
buildConfiguration: Prerelease

steps:
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Restore dependencies
run: dotnet restore
- name: Build Data
run: dotnet build **/Data.csproj -c ${{env.buildConfiguration}} /p:Version=${{ env.build_num }} --no-restore

- name: Build data
run: dotnet build **/Data.csproj -c ${{env.buildConfiguration}} /p:Version=${{ env.buildNumber }} --no-restore

- name: Build SLC
run: dotnet build **/SharedLibraryCore.csproj -c ${{env.buildConfiguration}} /p:Version=${{ env.build_num }} --no-restore
run: dotnet build **/SharedLibraryCore.csproj -c ${{env.buildConfiguration}} /p:Version=${{ env.buildNumber }} --no-restore

- name: Pack SLC
run: dotnet pack **/SharedLibraryCore.csproj -c ${{env.buildConfiguration}} -p:PackageVersion=${{ env.build_num }} -o ${{ env.outputDirectory }}
run: dotnet pack **/SharedLibraryCore.csproj -c ${{env.buildConfiguration}} -p:PackageVersion=${{ env.buildNumber }}${{ env.packageTag }} -o ${{ env.outputDirectory }} --no-restore

- name: Publish nuget package artifact
uses: actions/upload-artifact@v4
with:
name: SharedLibraryCore-${{ steps.generate_build_number.outputs.build_num }}
name: SharedLibraryCore-${{ env.buildNumber }}
path: ${{ env.outputDirectory }}/*.nupkg

publish:
runs-on: ubuntu-latest

needs: [ build_pack ]
needs: [ make_version, build_pack ]
environment: prerelease
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/release/pre' || github.ref == 'refs/heads/release/develop' }}

steps:
- name: Download Artifact
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: SharedLibraryCore-${{ needs.build_pack.outputs.build_num }}
name: SharedLibraryCore-${{ needs.make_version.outputs.build_num }}
path: ${{ env.outputDirectory }}

- name: Setup .NET
Expand Down

0 comments on commit bcad270

Please sign in to comment.