Skip to content

Commit 24835e7

Browse files
authored
Create update-veracode-cli
0 parents  commit 24835e7

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Update the Veracode CLI
2+
on:
3+
schedule:
4+
- cron: '0 2 * * *'
5+
workflow_dispatch:
6+
jobs:
7+
update-veracode-cli:
8+
runs-on: ubuntu-latest
9+
continue-on-error: true
10+
permissions:
11+
contents: write
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Update Veracode CLI to latest version
15+
run: |
16+
cd helper/cli
17+
cliFile=$(ls -1 . | head -n 1)
18+
echo "Filename: $cliFile"
19+
local_version="${cliFile#*_}"
20+
local_version="${local_version%%_*}"
21+
echo "Local version: $local_version"
22+
curl -sSO https://tools.veracode.com/veracode-cli/LATEST_VERSION
23+
latest_version=$(<"LATEST_VERSION")
24+
echo "Latest version: $latest_version"
25+
if [[ "$local_version" == "$latest_version" ]]; then
26+
echo "We already have the latest version - nothing to do here"
27+
rm -rf LATEST_VERSION
28+
else
29+
echo "There is a new version we need to downlaod"
30+
downloadUrl="https://tools.veracode.com/veracode-cli/veracode-cli_${latest_version}_linux_x86.tar.gz"
31+
echo "Download URL: $downloadUrl"
32+
curl -sSO $downloadUrl
33+
curl -sS -o veracode-cli_${latest_version}_windows.ps1 https://tools.veracode.com/veracode-cli/install.ps1
34+
ls -la
35+
echo "CLEAN UP"
36+
rm -rf veracode-cli_${local_version}_linux_x86.tar.gz
37+
rm -rf LATEST_VERSION
38+
ls -la
39+
fi
40+
- name: commit back to repo
41+
run: |
42+
git config --global user.name 'veracode'
43+
git config --global user.email 'cli@veracode.com'
44+
# Check if there are any changes
45+
if [[ -n "$(git status --porcelain)" ]]; then
46+
echo "Changes detected — committing and pushing latest CLI."
47+
git add -A
48+
git commit -m "New CLI Version"
49+
git push --verbose
50+
else
51+
echo "No changes to commit."
52+
fi

0 commit comments

Comments
 (0)