-
Notifications
You must be signed in to change notification settings - Fork 204
Workflow to automatically bump cli version if different from the current version #1871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
3f39af2
5420416
2723816
ec9078d
f7d4891
09d744a
c89d267
f2076df
5a42b8b
91dc39b
7f05af9
c72734e
ef14446
365519a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Bump CLI version | ||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
schedule: | ||
tjgurwara99 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- cron: 0 0 */14 * * # run every 14 days | ||
tjgurwara99 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
jobs: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a With this change, I think we can avoid changing the setting to grant read+write permissions to workflows on PRs from forks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh ok. I did try that but it failed, I thought maybe it still needed that permission - didn't know it was because it was from the fork, it got rejected. That's great, thanks! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It still won't work on your fork, which is ok. The If you're making automation changes in future it may be easier to use a branch on the parent repo (otherwise forks are totally fine). |
||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
token: ${{ secrets.WORKFLOW_TOKEN }} | ||
tjgurwara99 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -qq jq | ||
sudo apt-get install gh | ||
tjgurwara99 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
shell: bash | ||
- name: Bump CLI | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
tjgurwara99 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 | ||
tjgurwara99 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
gh pr create --title "Bump CLI Version for integration tests" --body "" | ||
tjgurwara99 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
tjgurwara99 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
LATEST_VERSION=$(echo $VERSIONS | awk '{ print $1 }' | sed "s/\"//g") | ||
PREVIOUS_VERSION=$(echo $VERSIONS | awk '{ print $2 }' | sed "s/\"//g") | ||
tjgurwara99 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we still need this, or can There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It can probably read from that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Happy to help if you have setup problems. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixing this can be done at a later time. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added an issue to track this. |
Uh oh!
There was an error while loading. Please reload this page.