Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions build-npm/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,10 @@ runs:
echo "🐸 [Browse build \`${build_name}:${BUILD_NUMBER}\` in Artifactory](${ARTIFACTORY_BROWSE_URL})" >> $GITHUB_STEP_SUMMARY
"$ACTION_PATH_BUILD_NPM/../shared/generate-jfrog-summary.sh" repox
fi

- name: Clean up local action symlinks
if: always()
shell: bash
run: |
rm -f .actions/get-build-number .actions/config-npm .actions/shared
rmdir .actions 2>/dev/null || true
2 changes: 1 addition & 1 deletion build-npm/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jfrog_npm_publish() {
jf config remove repox > /dev/null 2>&1 || true # Ignore inexistent configuration
jf config add repox --url "${ARTIFACTORY_URL%/artifactory*}" --artifactory-url "$ARTIFACTORY_URL" --access-token "$ARTIFACTORY_DEPLOY_ACCESS_TOKEN"
jf config use repox
jf npm-config --repo-resolve "npm" --repo-deploy "$ARTIFACTORY_DEPLOY_REPO"
jf npm-config --global --repo-resolve "npm" --repo-deploy "$ARTIFACTORY_DEPLOY_REPO"

export PROJECT="${GITHUB_REPOSITORY#*/}"
echo "PROJECT: ${PROJECT}"
Expand Down
7 changes: 7 additions & 0 deletions build-yarn/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -221,3 +221,10 @@ runs:
echo "🐸 [Browse build \`${build_name}:${BUILD_NUMBER}\` in Artifactory](${ARTIFACTORY_BROWSE_URL})" >> $GITHUB_STEP_SUMMARY
"$ACTION_PATH_BUILD_YARN/../shared/generate-jfrog-summary.sh" repox
fi

- name: Clean up local action symlinks
if: always()
shell: bash
run: |
rm -f .actions/get-build-number .actions/shared
rmdir .actions 2>/dev/null || true
4 changes: 2 additions & 2 deletions build-yarn/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ EOF
jf config remove repox > /dev/null 2>&1 || true # Ignore inexistent configuration
jf config add repox --url "${ARTIFACTORY_URL%/artifactory*}" --artifactory-url "$ARTIFACTORY_URL" --access-token "$ARTIFACTORY_ACCESS_TOKEN"
jf config use repox
jf npm-config --repo-resolve "npm"
jf npm-config --global --repo-resolve "npm"
}

set_project_version() {
Expand Down Expand Up @@ -175,7 +175,7 @@ jfrog_yarn_publish() {
jf config remove repox > /dev/null 2>&1 || true # Ignore inexistent configuration
jf config add repox --url "${ARTIFACTORY_URL%/artifactory*}" --artifactory-url "$ARTIFACTORY_URL" --access-token "$ARTIFACTORY_DEPLOY_ACCESS_TOKEN"
jf config use repox
jf npm-config --repo-resolve "npm" --repo-deploy "$ARTIFACTORY_DEPLOY_REPO"
jf npm-config --global --repo-resolve "npm" --repo-deploy "$ARTIFACTORY_DEPLOY_REPO"

# Create a local tarball and preserve it for attestation
echo "Creating local tarball for attestation..."
Expand Down
7 changes: 7 additions & 0 deletions config-npm/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,10 @@ runs:
if: steps.config-npm-completed.outputs.skip != 'true'
shell: bash
run: echo "CONFIG_NPM_COMPLETED=$GITHUB_ACTION" >> "$GITHUB_ENV"

- name: Clean up local action symlinks
if: always() && steps.config-npm-completed.outputs.skip != 'true'
shell: bash
run: |
rm -f .actions/get-build-number .actions/shared
rmdir .actions 2>/dev/null || true
2 changes: 1 addition & 1 deletion config-npm/npm_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ EOF
jf config remove repox > /dev/null 2>&1 || true # Ignore inexistent configuration
jf config add repox --url "${ARTIFACTORY_URL%/artifactory*}" --artifactory-url "$ARTIFACTORY_URL" --access-token "$ARTIFACTORY_ACCESS_TOKEN"
jf config use repox
jf npm-config --repo-resolve "npm"
jf npm-config --global --repo-resolve "npm"
return 0
}

Expand Down
9 changes: 5 additions & 4 deletions get-build-number/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ runs:
fi
echo "ACTION_PATH_GET_BUILD_NUMBER=$ACTION_PATH_GET_BUILD_NUMBER"
echo "ACTION_PATH_GET_BUILD_NUMBER=$ACTION_PATH_GET_BUILD_NUMBER" >> "$GITHUB_ENV"
echo "BUILD_NUMBER_FILE=${RUNNER_TEMP}/build_number.txt" >> "$GITHUB_ENV"
echo "::endgroup::"

# Reuse build number from environment if provided (e.g. from a parent workflow)
Expand All @@ -38,7 +39,7 @@ runs:
shell: bash
run: |
echo "BUILD_NUMBER ${BUILD_NUMBER} provided from environment, skipping both increment and save to cache."
echo "${BUILD_NUMBER}" > build_number.txt
echo "${BUILD_NUMBER}" > "$BUILD_NUMBER_FILE"
echo "skip=true" >> $GITHUB_OUTPUT

# Reuse current build number in case of rerun
Expand All @@ -47,7 +48,7 @@ runs:
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
id: current-build-number
with:
path: build_number.txt
path: ${{ env.BUILD_NUMBER_FILE }}
key: build-number-${{ github.run_id }}
enableCrossOsArchive: true

Expand All @@ -69,7 +70,7 @@ runs:
id: export
shell: bash
run: |
BUILD_NUMBER=$(cat build_number.txt)
BUILD_NUMBER=$(cat "$BUILD_NUMBER_FILE")
echo "BUILD_NUMBER: ${BUILD_NUMBER}"
echo "BUILD_NUMBER=${BUILD_NUMBER}" >> "$GITHUB_ENV"
echo "BUILD_NUMBER=${BUILD_NUMBER}" >> "$GITHUB_OUTPUT"
Expand All @@ -78,6 +79,6 @@ runs:
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
if: steps.from-env.outputs.skip != 'true' && steps.current-build-number.outputs.cache-hit != 'true'
with:
path: build_number.txt
path: ${{ env.BUILD_NUMBER_FILE }}
key: build-number-${{ github.run_id }}
enableCrossOsArchive: true
2 changes: 1 addition & 1 deletion get-build-number/get_build_number.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -euo pipefail

: "${GITHUB_REPOSITORY:?}"
GH_API_VERSION_HEADER="X-GitHub-Api-Version: 2022-11-28"
CACHE_FILE="build_number.txt"
CACHE_FILE="${BUILD_NUMBER_FILE:-${RUNNER_TEMP}/build_number.txt}"
Comment thread
matemoln marked this conversation as resolved.

echo "Fetching build number from repository properties..."
PROPERTIES_API_URL="repos/${GITHUB_REPOSITORY}/properties/values"
Expand Down
2 changes: 1 addition & 1 deletion spec/config-npm_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Describe 'set_build_env()'
The line 1 should include "Configuring JFrog and NPM repositories"
The line 2 should equal "jf config add repox --url https://repox.jfrog.io --artifactory-url https://repox.jfrog.io/artifactory --access-token reader-token"
The line 3 should equal "jf config use repox"
The line 4 should equal "jf npm-config --repo-resolve npm"
The line 4 should equal "jf npm-config --global --repo-resolve npm"
End
End

Expand Down
4 changes: 3 additions & 1 deletion spec/get_build_number_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
eval "$(shellspec - -c) exit 1"

export GITHUB_REPOSITORY="my org/my-repo"
CACHE_FILE="build_number.txt"
export RUNNER_TEMP="${SHELLSPEC_TMPBASE:-/tmp}"
export BUILD_NUMBER_FILE="${RUNNER_TEMP}/build_number.txt"
CACHE_FILE="${BUILD_NUMBER_FILE}"

Mock gh
echo "gh $*"
Expand Down
Loading