Skip to content

Commit 9a3c6ff

Browse files
add update script and manual tag creation (#15)
1 parent 88c281e commit 9a3c6ff

File tree

6 files changed

+113
-20
lines changed

6 files changed

+113
-20
lines changed

.github/scripts/update_cli.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
release=$1
4+
filename_windows=ast-cli_${release}_windows_x64.zip
5+
filename_linux=ast-cli_${release}_linux_x64.tar.gz
6+
filename_darwin=ast-cli_${release}_darwin_x64.tar.gz
7+
8+
#Windows
9+
echo "Updating windows binary"
10+
wget https://github.com/Checkmarx/ast-cli/releases/download/${release}/${filename_windows}
11+
unzip ${filename_windows} -d tmp
12+
mv ./tmp/cx.exe ./src/main/resources/cx.exe
13+
rm -r tmp
14+
rm ${filename_windows}
15+
16+
#linux
17+
echo "Updating linux binary"
18+
wget https://github.com/Checkmarx/ast-cli/releases/download/${release}/${filename_linux}
19+
mkdir ./tmp/
20+
tar -xvzf ${filename_linux} -C ./tmp/
21+
mv ./tmp/cx ./src/main/resources/cx-linux
22+
rm -r tmp
23+
rm ${filename_linux}
24+
25+
#darwin
26+
echo "Updating mac binary"
27+
wget https://github.com/Checkmarx/ast-cli/releases/download/${release}/${filename_darwin}
28+
mkdir ./tmp/
29+
tar -xvzf ${filename_darwin} -C ./tmp/
30+
mv ./tmp/cx ./src/main/resources/cx-mac
31+
rm -r tmp
32+
rm ${filename_darwin}
Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,12 @@
1-
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3-
4-
name: Integration Tests
5-
6-
on:
7-
push:
8-
branches: [ master ]
9-
pull_request:
10-
branches: [ master ]
1+
name: AST Javascript wrapper CI
112

3+
on: [pull_request]
124
jobs:
135
build:
14-
156
runs-on: ubuntu-latest
16-
177
strategy:
188
matrix:
19-
#node-version: [10.x, 12.x, 14.x, 15.x]
209
node-version: [ 15.x ]
21-
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
22-
2310
steps:
2411
- uses: actions/checkout@v2
2512
- name: Copy executable

.github/workflows/manual-tag.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Manual Tag Creation
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: 'Next release tag'
8+
required: true
9+
10+
jobs:
11+
tag-creation:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v2.3.4
16+
with:
17+
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
18+
- name: Tag
19+
run: |
20+
echo ${{ github.event.inputs.tag }}
21+
echo "NEXT_VERSION=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
22+
- name: Create tag
23+
uses: actions-ecosystem/action-push-tag@v1
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
26+
with:
27+
tag: ${{ env.NEXT_VERSION }}
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
1-
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
3-
41
name: Node.js Package
52

63
on:
7-
release:
8-
types: [created]
4+
push:
5+
tags:
6+
- "*"
97

108
jobs:
119
publish-gpr:
1210
runs-on: ubuntu-latest
1311
steps:
1412
- uses: actions/checkout@v2
13+
- name: Set env
14+
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
1515
- uses: actions/setup-node@v2
1616
with:
1717
node-version: 12
1818
registry-url: https://npm.pkg.github.com/
1919
- run: npm ci
20+
- name: Update version
21+
run: npm version ${{ env.RELEASE_VERSION }}
2022
- name: npm build
2123
run: npm run build
2224
- name: Set up NPM authentication

.github/workflows/update-cli.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Update checkmarx ast cli
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: '*/5 * * * *'
6+
7+
jobs:
8+
update-checkmarx-cli:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Get Latest Checkmarx API version
13+
id: checkmarx-ast-cli
14+
run: |
15+
echo ::set-output name=release_tag::$(curl -sL https://api.github.com/repos/Checkmarx/ast-cli/releases/latest | jq -r ".tag_name")
16+
echo ::set-output name=current_tag::$(<checkmarx-ast-cli.version)
17+
- name: Update Checkmarx cli version
18+
if: steps.checkmarx-ast-cli.outputs.current_tag != steps.checkmarx-ast-cli.outputs.release_tag
19+
env:
20+
RELEASE_TAG: ${{ steps.checkmarx-ast-cli.outputs.release_tag }}
21+
run: |
22+
# Update current release
23+
echo ${{ steps.checkmarx-ast-cli.outputs.release_tag }} > checkmarx-ast-cli.version
24+
- name: Download latest cli and update branch
25+
if: steps.checkmarx-ast-cli.outputs.current_tag != steps.checkmarx-ast-cli.outputs.release_tag
26+
run: |
27+
# Update binaries
28+
chmod +x ./.github/scripts/update_cli.sh
29+
./.github/scripts/update_cli.sh ${{ steps.checkmarx-ast-cli.outputs.release_tag }}
30+
- name: Create Pull Request
31+
if: steps.checkmarx-ast-cli.outputs.current_tag != steps.checkmarx-ast-cli.outputs.release_tag
32+
uses: peter-evans/create-pull-request@v3
33+
with:
34+
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
35+
commit-message: Update checkmarx-ast-cli to ${{ steps.checkmarx-ast-cli.outputs.release_tag }}
36+
title: Update checkmarx-ast-cli binaries with ${{ steps.checkmarx-ast-cli.outputs.release_tag }}
37+
body: |
38+
Updates [checkmarx-ast-cli][1] to ${{ steps.checkmarx-ast-cli.outputs.release_tag }}
39+
40+
Auto-generated by [create-pull-request][2]
41+
42+
[1]: https://github.com/Checkmarx/checkmarx-ast-cli
43+
labels: dependencies, automated pr
44+
branch: feature/update_cli

checkmarx-ast-cli.version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.0.0-rc.22

0 commit comments

Comments
 (0)