Skip to content

Commit

Permalink
update release CI
Browse files Browse the repository at this point in the history
  • Loading branch information
BenoitRanque committed Oct 9, 2024
1 parent 4de036e commit 002413c
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/bump-version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ jobs:
exit 1
fi
BRANCH_NAME="release-$NEW_VERSION"
# Create a new feature branch for the changes.
git checkout -b $BRANCH_NAME
# update version in Cargo.toml
sed -i 's/package.version = .*/package.version = "${NEW_VERSION}"/' Cargo.toml
# update version in Cargo.lock
Expand All @@ -38,6 +43,17 @@ jobs:
sed -i "s/## \[Unreleased\]/$CHANGELOG_TEMPLATE/" CHANGELOG.md
git add .
git commit -m "Release ClickHouse v$NEW_VERSION"
git push origin $BRANCH_NAME
# create a pull-requests containing the updates.
gh pr create \
--body "Commit in ndc-clickhouse: https://github.com/hasura/ndc-clickhouse/commit/$RELEASE_HASH" \
--title "Bump Clickhouse to $NEW_VERSION" \
--head "$BRANCH_NAME" \
--base "main"
- uses: peter-evans/create-pull-request@v7
with:
branch: release-v${{ github.event.inputs.new_version }}
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/tag-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# on merge to main from a branch named release-*, create a tag based on version in Cargo.toml
name: Bump version
on:
pull_request:
types:
- closed
branches:
- main

jobs:
build:
if: github.event.pull_request.merged == true
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}
fetch-depth: '0'

- uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Read version from Cargo.toml
id: read-version
run: |
CARGO_VERSION="$(cargo metadata --format-version=1 | jq -r '.packages | .[] | select(.name == "ndc-clickhouse-cli") | .version')"
echo("::set-output name=RELEASE_VERSION::$CARGO_VERSION")
- name: Bump version and push tag
uses: anothrNick/github-tag-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_BRANCHES: release-.*
CUSTOM_TAG: v${{ steps.read-version.outputs.RELEASE_VERSION }}

0 comments on commit 002413c

Please sign in to comment.