Skip to content

Commit 01930cf

Browse files
authored
Fix flaky npm latest version fetch (#2545)
1 parent 8a23e09 commit 01930cf

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

.github/workflows/scriptTests.yml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -100,26 +100,24 @@ jobs:
100100
./jfrog.exe --version
101101
if: contains( matrix.suite.os, 'windows')
102102

103-
# Prior to the release, we set the new version in the package.json files, introducing the pre-released version.
104-
# This adjustment may result in an attempt to download a version that hasn't been published to releases.jfrog.io yet.
105-
# To handle it, we fetch the most recent JFrog CLI release and store it in the LATEST_RELEASE step output.
106-
- name: "Get latest release"
107-
id: latest-release
108-
run: |
109-
export LATEST_RELEASE=`curl https://api.github.com/repos/jfrog/jfrog-cli/releases/latest -s --retry 10 | jq .name -r | sed "s/^v//"`
110-
echo "LATEST_RELEASE=$LATEST_RELEASE" >> "$GITHUB_OUTPUT"
111-
shell: bash
112-
113103
- name: Test install npm - v2
114104
working-directory: build/npm/v2
105+
# Prior to the release, we set the new version in the package.json files, introducing the pre-released version.
106+
# This adjustment may result in an attempt to download a version that hasn't been published to releases.jfrog.io yet.
107+
# To handle it, we fetch the most recent JFrog CLI release and store it in the latest_version param.
115108
run: |
116-
npm version ${{ steps.latest-release.outputs.LATEST_RELEASE }} --allow-same-version
117-
npm install
109+
latest_version=$(npm view jfrog-cli-v2 version)
110+
npm version $latest_version --allow-same-version
111+
npm install --no-audit
118112
./bin/jfrog${{ matrix.suite.osSuffix }} --version
119113
120114
- name: Test install npm - v2-jf
121115
working-directory: build/npm/v2-jf
116+
# Prior to the release, we set the new version in the package.json files, introducing the pre-released version.
117+
# This adjustment may result in an attempt to download a version that hasn't been published to releases.jfrog.io yet.
118+
# To handle it, we fetch the most recent JFrog CLI release and store it in the latest_version param.
122119
run: |
123-
npm version ${{ steps.latest-release.outputs.LATEST_RELEASE }} --allow-same-version
124-
npm install
120+
latest_version=$(npm view jfrog-cli-v2-jf version)
121+
npm version $latest_version --allow-same-version
122+
npm install --no-audit
125123
./bin/jf${{ matrix.suite.osSuffix }} --version

0 commit comments

Comments
 (0)