Merge pull request #303 from aiven/byashimov-NEX-99-add-clickhouseuse… #132
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "**.go" | |
- "**/go.mod" | |
- "**/go.sum" | |
workflow_dispatch: {} | |
permissions: read-all | |
jobs: | |
releaser: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- id: version | |
uses: anothrNick/github-tag-action@1.73.0 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
WITH_V: true | |
DRY_RUN: true | |
- run: | | |
tee version.go << END | |
package aiven | |
// Version returns aiven-go-client version string | |
func Version() string { return "${{ steps.version.outputs.new_tag }}" } | |
END | |
git add version.go | |
# Only commit and push if version.go actually changed | |
if ! git diff --staged --quiet; then # Check only staged changes | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git commit -m "chore(version.go): update go-client-codegen version" | |
git pull --rebase origin main | |
git push | |
else | |
echo "No changes to version.go to commit." | |
# Even if no changes, ensure the branch is synced before tagging | |
git pull --rebase origin main | |
fi | |
- id: sha | |
run: | | |
GIT_SHA=$(git rev-parse HEAD) | |
echo "sha=${GIT_SHA::7}" >> $GITHUB_OUTPUT | |
- id: tag | |
uses: anothrNick/github-tag-action@1.73.0 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
WITH_V: true | |
- uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ steps.version.outputs.new_tag }} | |
name: ${{ steps.version.outputs.new_tag }} | |
body: auto-generated release for commit ${{ steps.sha.outputs.sha }} |