workflow to automatically bump cli version if different from the current version
This commit is contained in:
44
.github/workflows/bump-cli.yml
vendored
Normal file
44
.github/workflows/bump-cli.yml
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
name: Bump CLI version
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
schedule:
|
||||
- cron: 0 0 */14 * * # run every 14 days
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
token: ${{ secrets.WORKFLOW_TOKEN }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -qq jq
|
||||
sudo apt-get install gh
|
||||
shell: bash
|
||||
- name: Bump CLI
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
scripts/replace-cli-version.sh
|
||||
- name: Push changes to a branch
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
|
||||
run: |
|
||||
git config user.name github-actions
|
||||
git config user.email github-actions@github.com
|
||||
git checkout -b bump-cli
|
||||
if [[ `git status --porcelain` ]]; then
|
||||
git add .
|
||||
git commit -m "automatically bump cli version"
|
||||
git push --set-upstream origin bump-cli
|
||||
git push
|
||||
gh pr create --title "Bump CLI Version for integration tests" --body ""
|
||||
fi
|
||||
9
scripts/replace-cli-version.sh
Executable file
9
scripts/replace-cli-version.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
VERSIONS=$(gh api -H "Accept: application/vnd.github+json" /repos/github/codeql-cli-binaries/releases | jq '.[].tag_name' | head -2)
|
||||
|
||||
LATEST_VERSION=$(echo $VERSIONS | awk '{ print $1 }' | sed "s/\"//g")
|
||||
PREVIOUS_VERSION=$(echo $VERSIONS | awk '{ print $2 }' | sed "s/\"//g")
|
||||
|
||||
sed -i "s/$PREVIOUS_VERSION/$LATEST_VERSION/g" .github/workflows/main.yml
|
||||
sed -i "s/$PREVIOUS_VERSION/$LATEST_VERSION/g" extensions/ql-vscode/src/vscode-tests/ensureCli.ts
|
||||
Reference in New Issue
Block a user