Skip to content

Commit

Permalink
Merge pull request #143 from tgharold/20240412-0654
Browse files Browse the repository at this point in the history
Update JFrog .NET build scripts
  • Loading branch information
bwarner22 authored Apr 12, 2024
2 parents 3b32571 + af7fcb1 commit 4285f28
Show file tree
Hide file tree
Showing 4 changed files with 388 additions and 17 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/dotnet-build-jfrog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ on:
dotnet_version:
value: ${{ inputs.dotnet_version }}

jfrog_build_name_build:
description: The JFrog build name for the 'build' step is suffixed with '-build'.
jfrog_build_name:
description: The JFrog build name for the 'dotnet-build' step is suffixed with '-dotnet-build'.
value: ${{ jobs.build.outputs.jfrog_build_name }}

persisted_workspace_artifact_name:
Expand All @@ -107,16 +107,16 @@ jobs:
working-directory: ${{ inputs.project_directory }}

outputs:
persisted_workspace_artifact_name: ${{ steps.persist-workspace.outputs.artifact_name }}
jfrog_build_name: ${{ env.JFROG_CLI_BUILD_NAME }}
persisted_workspace_artifact_name: ${{ steps.persist-workspace.outputs.artifact_name }}

env:
CONFIGURATION: ${{ inputs.configuration }}
DOTNET_RESTORE_VERBOSITY: ${{ inputs.dotnet_restore_verbosity }}
NUGETHASHFILES: "${{ inputs.project_directory }}**/*.csproj"
PROJECTDIRECTORY: ${{ inputs.project_directory }}
JFROG_API_BASE_URL: ${{ inputs.jfrog_api_base_url }}
JFROG_CLI_BUILD_NAME: "${{ inputs.jfrog_build_name }}-build"
JFROG_CLI_BUILD_NAME: "${{ inputs.jfrog_build_name }}-dotnet-build"
JFROG_CLI_BUILD_NUMBER: ${{ inputs.jfrog_build_number }}
JFROG_CLI_LOG_LEVEL: ${{ inputs.jfrog_cli_log_level }}
JFROG_NUGET_FEED_REPO: ${{ inputs.jfrog_nuget_feed_repo }}
Expand All @@ -131,6 +131,12 @@ jobs:
regex_pattern: "^debug|release$"
value: ${{ env.CONFIGURATION }}

- name: Validate inputs.jfrog_build_name
uses: ritterim/public-github-actions/actions/[email protected]
with: # This regex pattern is a bit of a guess
regex_pattern: '^[A-Za-z0-9\-]{5,55}$'
value: ${{ inputs.jfrog_build_name }}

- name: Validate inputs.jfrog_nuget_feed_repo
uses: ritterim/public-github-actions/actions/[email protected]
with:
Expand Down
26 changes: 15 additions & 11 deletions .github/workflows/dotnet-pack-jfrog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ on:
type: string

jfrog_artifactory_repository:
description: 'JFrog Artifactory repository identifier.'
description: 'JFrog Artifactory repository identifier where artifacts will be uploaded to.'
required: true
type: string

Expand All @@ -47,11 +47,6 @@ on:
required: true
type: string

jfrog_build_name_build:
description: 'JFrog build name from the build step. We append that build to the pack step build-info.'
required: true
type: string

jfrog_build_number:
description: 'JFrog build number. Can be an integer, a semantic version, or a string.'
required: true
Expand Down Expand Up @@ -96,6 +91,10 @@ on:
artifact_name:
value: ${{ inputs.artifact_name }}

jfrog_build_name:
description: The JFrog build name for the 'dotnet-pack' step is suffixed with '-dotnet-pack'.
value: ${{ jobs.pack.outputs.jfrog_build_name }}

jobs:

pack:
Expand All @@ -105,6 +104,9 @@ jobs:
run:
working-directory: ${{ inputs.project_directory }}

outputs:
jfrog_build_name: ${{ env.JFROG_CLI_BUILD_NAME }}

env:
ARTIFACTNAME: ${{ inputs.artifact_name }}
ARTIFACTPATHSPEC: "${{ inputs.project_directory }}artifacts/*.*nupkg"
Expand All @@ -113,8 +115,7 @@ jobs:
JFROG_SERVER_ID: setup-jfrog-cli-server
JFROG_API_BASE_URL: ${{ inputs.jfrog_api_base_url }}
JFROG_ARTIFACTORY_REPOSITORY: ${{ inputs.jfrog_artifactory_repository }}
JFROG_CLI_BUILD_NAME: "${{ inputs.jfrog_build_name }}"
JFROG_CLI_BUILD_NAME_BUILD: "${{ inputs.jfrog_build_name_build }}"
JFROG_CLI_BUILD_NAME: "${{ inputs.jfrog_build_name }}-dotnet-pack"
JFROG_CLI_BUILD_NUMBER: ${{ inputs.jfrog_build_number }}
JFROG_CLI_LOG_LEVEL: ${{ inputs.jfrog_cli_log_level }}
JFROG_NUGET_FEED_REPO: ${{ inputs.jfrog_nuget_feed_repo }}
Expand All @@ -138,6 +139,12 @@ jobs:
regex_pattern: "^debug|release$"
value: ${{ env.CONFIGURATION }}

- name: Validate inputs.jfrog_build_name
uses: ritterim/public-github-actions/actions/[email protected]
with: # This regex pattern is a bit of a guess
regex_pattern: '^[A-Za-z0-9\-]{5,55}$'
value: ${{ inputs.jfrog_build_name }}

- name: Validate inputs.project_directory
uses: ritterim/public-github-actions/actions/[email protected]
with:
Expand Down Expand Up @@ -254,8 +261,5 @@ jobs:
working-directory: ${{ env.ARTIFACTRELATIVEFOLDER }}
continue-on-error: true

- name: Append the JFrog "-build" build-info to this build-info
run: jf rt build-append "${JFROG_CLI_BUILD_NAME}" "${JFROG_CLI_BUILD_NUMBER}" "${JFROG_CLI_BUILD_NAME_BUILD}" "${JFROG_CLI_BUILD_NUMBER}"

- name: Push JFrog Build Information
run: jf rt build-publish "${JFROG_CLI_BUILD_NAME}" "${JFROG_CLI_BUILD_NUMBER}"
Loading

0 comments on commit 4285f28

Please sign in to comment.