Skip to content

Commit

Permalink
BUILD-7128: Filter builds when downloading javadoc (#289)
Browse files Browse the repository at this point in the history
* BUILD-7128: Filter builds when downloading javadoc

* BUILD-7128: Apply review comments

* BUILD-7128: fix filter

Co-authored-by: Julien Carsique <[email protected]>

---------

Co-authored-by: Julien Carsique <[email protected]>
  • Loading branch information
tomverin and julien-carsique-sonarsource authored Jan 3, 2025
1 parent db0d9bd commit dae0992
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/javadoc-publication.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,20 @@ jobs:
uses: SonarSource/jfrog-setup-wrapper@58546d2106f9d38c37590b7f125f85b0d1fa4cee # 3.5.0
with:
jfrogAccessToken: ${{ fromJSON(steps.secrets.outputs.vault).artifactory_access_token }}
- name: Create a path filter from the groupId for artifactory build search
id: filter
run: |
jfrog rt curl -X GET "/api/build/${{ github.event.repository.name }}/${{ steps.get_version.outputs.build }}" > build-info.json
groupIdPath=$(jq -r '.buildInfo.modules[0].id' build-info.json | cut -d':' -f1 | tr '.' '/')
echo "path: $groupIdPath"
echo "groupIdPath=${groupIdPath}" >> $GITHUB_OUTPUT
- name: Download Artifacts
uses: SonarSource/gh-action_release/download-build@master
with:
flat-download: true
build-number: ${{ steps.get_version.outputs.build }}
local-repo-dir: ${{ steps.local_repo.outputs.dir }}
filter: ${{ steps.filter.outputs.groupIdPath }}
remote-repo: ${{ inputs.publicRelease == true && 'sonarsource-public-releases' || 'sonarsource-private-releases'}}
- name: Keep only javadoc.jar
run: find ${{ steps.local_repo.outputs.dir }} -type f ! -name "*-javadoc.jar" -delete
Expand Down
18 changes: 14 additions & 4 deletions download-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ inputs:
build-number:
description: 'Build number'
required: true
filter:
description: 'Path to the artifacts to download'
required: false
default: ''
exclusions:
description: 'Exclude pattern from downloaded files'
required: false
Expand Down Expand Up @@ -61,10 +65,16 @@ runs:
JFROG_DL_BUILD: ${{ github.event.repository.name }}/${{ inputs.build-number }}
JFROG_DL_EXCLUSIONS: ${{ inputs.exclusions }}
JFROG_DL_REMOTE_REPO: ${{ inputs.remote-repo }}
run: jfrog rt download
--fail-no-op ${{ steps.define-download-options.outputs.jfrog_dl_options }}
--build "${JFROG_DL_BUILD}"
"${JFROG_DL_REMOTE_REPO}"
FILTER: ${{ inputs.filter }}
run: |
if [ -n "$FILTER" ]; then
JFROG_DL_REMOTE_REPO="${JFROG_DL_REMOTE_REPO}/$FILTER/"
fi
echo "$JFROG_DL_REMOTE_REPO"
jfrog rt download \
--fail-no-op ${{ steps.define-download-options.outputs.jfrog_dl_options }} \
--build "${JFROG_DL_BUILD}" \
"${JFROG_DL_REMOTE_REPO}"
- name: Download checksums
if: ${{ inputs.dryRun != 'true' && inputs.download-checksums == 'true' }}
shell: bash
Expand Down

0 comments on commit dae0992

Please sign in to comment.