Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 67 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,63 @@ name: Release

on:
push:
tags:
- "v*"
branches:
- main

jobs:
check:
name: Check version and create release
runs-on: ubuntu-latest
outputs:
version_changed: ${{ steps.check.outputs.version_changed }}
new_version: ${{ steps.check.outputs.new_version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Check for version change
id: check
run: |
# Get the current version from Cargo.toml
CURRENT_VERSION=$(grep -m1 '^version = ' Cargo.toml | sed 's/version = "\(.*\)"/\1/')

# Get the previous version from the last commit
git checkout HEAD~1 -- Cargo.toml 2>/dev/null || true
if [ -f Cargo.toml ]; then
PREVIOUS_VERSION=$(grep -m1 '^version = ' Cargo.toml | sed 's/version = "\(.*\)"/\1/')
git checkout HEAD -- Cargo.toml
else
PREVIOUS_VERSION=""
fi

echo "Current version: $CURRENT_VERSION"
echo "Previous version: $PREVIOUS_VERSION"

if [ "$CURRENT_VERSION" != "$PREVIOUS_VERSION" ] && [ -n "$CURRENT_VERSION" ]; then
echo "version_changed=true" >> $GITHUB_OUTPUT
echo "new_version=v$CURRENT_VERSION" >> $GITHUB_OUTPUT
echo "Version changed from $PREVIOUS_VERSION to $CURRENT_VERSION"
else
echo "version_changed=false" >> $GITHUB_OUTPUT
echo "No version change detected"
fi

- name: Create GitHub Release
if: steps.check.outputs.version_changed == 'true'
env:
GH_TOKEN: ${{ github.token }}
run: |
VERSION=${{ steps.check.outputs.new_version }}
echo "Creating release for $VERSION"
gh release create "$VERSION" \
--title "Release $VERSION" \
--generate-notes \
|| echo "Release already exists"

build_linux:
needs: check
if: needs.check.outputs.version_changed == 'true'
name: build ${{ matrix.target }}
strategy:
matrix:
Expand Down Expand Up @@ -43,9 +95,11 @@ jobs:
with:
os: linux
target: ${{ matrix.target }}
version: ${{ github.ref_name }}
version: ${{ needs.check.outputs.new_version }}

build_other:
needs: check
if: needs.check.outputs.version_changed == 'true'
name: build ${{ matrix.target }}
strategy:
matrix:
Expand Down Expand Up @@ -81,10 +135,11 @@ jobs:
with:
os: ${{ matrix.os }}
target: ${{ matrix.target }}
version: ${{ github.ref_name }}
version: ${{ needs.check.outputs.new_version }}

update_repo:
needs: [build_linux, build_other]
needs: [check, build_linux, build_other]
if: needs.check.outputs.version_changed == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -103,8 +158,9 @@ jobs:
aws s3 cp releases.json s3://repo/bendsql/releases.json --checksum-algorithm=CRC32

crates:
needs: [check, build_linux]
if: needs.check.outputs.version_changed == 'true'
runs-on: ubuntu-latest
needs: build_linux
environment:
name: crates.io
url: https://crates.io/crates/databend-driver
Expand All @@ -125,7 +181,8 @@ jobs:
cargo workspaces publish --all --publish-as-is --yes

distribution:
needs: build_linux
needs: [check, build_linux]
if: needs.check.outputs.version_changed == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -173,17 +230,17 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: |
mkdir -p dist/pkg
gh release download ${{ github.ref_name }} --pattern "bendsql-${{ matrix.target }}.tar.gz" --dir dist/
gh release download ${{ needs.check.outputs.new_version }} --pattern "bendsql-${{ matrix.target }}.tar.gz" --dir dist/
tar -xzf dist/bendsql-${{ matrix.target }}.tar.gz -C dist/
- name: Package
shell: bash
run: |
yq -i '.arch = "${{ matrix.arch }}"' nfpm.yaml
yq -i '.version = "${{ github.ref_name }}"' nfpm.yaml
yq -i '.version = "${{ needs.check.outputs.new_version }}"' nfpm.yaml
nfpm package --packager ${{ matrix.packager }} --target dist/pkg/
- name: Publish
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release upload ${{ github.ref_name }} dist/pkg/* --clobber
gh release upload ${{ needs.check.outputs.new_version }} dist/pkg/* --clobber
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ resolver = "2"

[workspace.package]
edition = "2021"
version = "0.33.1"
version = "0.33.2"
license = "Apache-2.0"
authors = ["Databend Authors <opensource@databend.com>"]
categories = ["database"]
keywords = ["databend", "database", "rust"]
repository = "https://github.com/databendlabs/bendsql"

[workspace.dependencies]
databend-client = { path = "core", version = "0.33.1" }
databend-driver = { path = "driver", version = "0.33.1" }
databend-driver-core = { path = "sql", version = "0.33.1" }
databend-driver-macros = { path = "macros", version = "0.33.1" }
databend-client = { path = "core", version = "0.33.2" }
databend-driver = { path = "driver", version = "0.33.2" }
databend-driver-core = { path = "sql", version = "0.33.2" }
databend-driver-macros = { path = "macros", version = "0.33.2" }

jsonb = { version = "0.5.5" }
tokio-stream = "0.1"
Expand Down
2 changes: 1 addition & 1 deletion bindings/nodejs/npm/darwin-arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@databend-driver/lib-darwin-arm64",
"repository": "https://github.com/databendlabs/bendsql.git",
"version": "0.33.1",
"version": "0.33.2",
"os": [
"darwin"
],
Expand Down
2 changes: 1 addition & 1 deletion bindings/nodejs/npm/darwin-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@databend-driver/lib-darwin-x64",
"repository": "https://github.com/databendlabs/bendsql.git",
"version": "0.33.1",
"version": "0.33.2",
"os": [
"darwin"
],
Expand Down
2 changes: 1 addition & 1 deletion bindings/nodejs/npm/linux-arm64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@databend-driver/lib-linux-arm64-gnu",
"repository": "https://github.com/databendlabs/bendsql.git",
"version": "0.33.1",
"version": "0.33.2",
"os": [
"linux"
],
Expand Down
2 changes: 1 addition & 1 deletion bindings/nodejs/npm/linux-arm64-musl/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@databend-driver/lib-linux-arm64-musl",
"repository": "https://github.com/databendlabs/bendsql.git",
"version": "0.33.1",
"version": "0.33.2",
"os": [
"linux"
],
Expand Down
2 changes: 1 addition & 1 deletion bindings/nodejs/npm/linux-x64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@databend-driver/lib-linux-x64-gnu",
"repository": "https://github.com/databendlabs/bendsql.git",
"version": "0.33.1",
"version": "0.33.2",
"os": [
"linux"
],
Expand Down
2 changes: 1 addition & 1 deletion bindings/nodejs/npm/linux-x64-musl/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@databend-driver/lib-linux-x64-musl",
"repository": "https://github.com/databendlabs/bendsql.git",
"version": "0.33.1",
"version": "0.33.2",
"os": [
"linux"
],
Expand Down
2 changes: 1 addition & 1 deletion bindings/nodejs/npm/win32-arm64-msvc/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@databend-driver/lib-win32-arm64-msvc",
"repository": "https://github.com/databendlabs/bendsql.git",
"version": "0.33.1",
"version": "0.33.2",
"os": [
"win32"
],
Expand Down
2 changes: 1 addition & 1 deletion bindings/nodejs/npm/win32-x64-msvc/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@databend-driver/lib-win32-x64-msvc",
"repository": "https://github.com/databendlabs/bendsql.git",
"version": "0.33.1",
"version": "0.33.2",
"os": [
"win32"
],
Expand Down
2 changes: 1 addition & 1 deletion bindings/nodejs/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "databend-driver",
"author": "Databend Authors <opensource@databend.com>",
"version": "0.33.1",
"version": "0.33.2",
"license": "Apache-2.0",
"main": "index.js",
"types": "index.d.ts",
Expand Down
Loading