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