Skip to content

Commit

Permalink
Merge pull request #1805 from quadratichq/repo-versioning
Browse files Browse the repository at this point in the history
Create bump.sh to bump all js and rust versions at once
  • Loading branch information
davidkircos committed Sep 10, 2024
2 parents dfbadc7 + 359c9b2 commit 0fbb384
Show file tree
Hide file tree
Showing 23 changed files with 495 additions and 229 deletions.
3 changes: 2 additions & 1 deletion .clabot
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"dependabot",
"dependabot[bot]",
"AyushAgrawal-A2",
"golok727"
"golok727",
"github-actions[bot]@users.noreply.github.com"
],
"message": "We require contributors to sign our Contributor License Agreement, and we don\"t have one on file for you. In order for us to review and merge your code, please contact our team at https://www.quadratichq.com/contact."
}
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,48 @@ jobs:
npm run lint:prettier
npm run lint:eslint
npm run lint:ts
check-version-increment:
runs-on: ubuntu-latest
# If we are merging into main, but not pushed on main
if: github.base_ref == 'main' && github.ref != 'refs/heads/main'
steps:
- name: Checkout current branch
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Get current VERSION
id: current_version
run: echo "CURRENT_VERSION=$(cat VERSION)" >> $GITHUB_OUTPUT

- name: Checkout main branch
uses: actions/checkout@v3
with:
ref: main
fetch-depth: 1

- name: Get main VERSION
id: main_version
run: echo "MAIN_VERSION=$(cat VERSION)" >> $GITHUB_OUTPUT

- name: Compare versions to main, verify this version is higher
run: |
current_version="${{ steps.current_version.outputs.CURRENT_VERSION }}"
main_version="${{ steps.main_version.outputs.MAIN_VERSION }}"
if [ "$(printf '%s\n' "$main_version" "$current_version" | sort -V | tail -n1)" != "$current_version" ]; then
echo "Error: VERSION in the current branch ($current_version) is not greater than VERSION in main ($main_version)"
exit 1
else
echo "VERSION check passed: Current branch ($current_version) > main ($main_version)"
fi
check-versions-match:
runs-on: ubuntu-latest

steps:
- name: Checkout current branch
uses: actions/checkout@v3

- name: Verify that all versions match
run: ./bump.sh verify
44 changes: 44 additions & 0 deletions .github/workflows/production-bump-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Bump Version on PR against to main

on:
workflow_dispatch:
inputs:
bump_type:
description: 'Type of version bump'
default: patch
type: choice
options:
- major
- minor
- patch
pull_request:
types: [opened]
branches:
- main

jobs:
bump-version:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Install jq
run: sudo apt-get install jq

- name: Run bump.sh script
run: ./bump.sh ${{ github.event.inputs.bump_type || 'patch' }}

- name: Commit and push changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add .
git commit -m 'Bump version' || exit 0
git pull --rebase
git push
Loading

0 comments on commit 0fbb384

Please sign in to comment.