Skip to content
Open
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
52 changes: 20 additions & 32 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,59 +27,47 @@ jobs:
fetch-depth: 0
ref: main
token: ${{ secrets.RELEASE_PAT }}

- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install argparse build semver twine
shell: bash

- name: Setup git config
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
shell: bash

- name: Checkout action repo
uses: actions/checkout@v2
with:
repository: firebolt-db/action-python-release
path: release_action

- name: Generate new version tag
id: tag_generation
- name: Get changes since last release
id: changes
run: |
OLD_TAG=$(git describe --tags --abbrev=0)
OLD_VERSION=$(echo $OLD_TAG | cut -c 2-)
echo "Old tag was ${OLD_TAG}"
CHANGE_LOG=$(git log $OLD_TAG..HEAD --pretty=format:%s)
NEW_VERSION=$(python3 release_action/scripts/generate_version_tag.py "${CHANGE_LOG}" $OLD_VERSION --prerelease_tag "${{ inputs.pre-release-tag }}" --major_release "${{ inputs.major-release }}")
NEW_TAG="v"$NEW_VERSION
echo "new_tag=$NEW_TAG" >> $GITHUB_OUTPUT
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
shell: bash
CHANGES=$(git log $OLD_TAG..HEAD --pretty=format:%s)
echo "changes<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
# Strip 'v' prefix from the old tag if it exists
echo "old_tag=$(echo $OLD_TAG | sed 's/^v//')" >> $GITHUB_OUTPUT

- name: Generate version
id: version
uses: firebolt-db/action-generate-version@v1
with:
changes: ${{ steps.changes.outputs.changes }}
old-tag: ${{ steps.changes.outputs.old_tag }}

- name: Version bump
run: |
# Bump version = <number> in version file
sed -i "s/SdkVersion string = .*/SdkVersion string = \"${{ steps.tag_generation.outputs.new_version }}\"/g" version/version.go
sed -i "s/SdkVersion string = .*/SdkVersion string = \"v${{ steps.version.outputs.new-tag }}\"/g" version/version.go
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see a lot of places where we do v${...}. Does this mean that the tag that we put in the release action does not have v at the beginning? For jdbc we set v3.6.2 in the job. In go when we what to release v3.6.2 do we trigger the job with 3.6.2?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't provide the tag manually, it's automatically inferred from the commits made since the last tag in this action. It returns the new version without the v prefix. This is fine for Python SDK and some others as they keep releases numeric only. However, Go has v prefix in its releases so I'm adding it afterwards.

git add version/version.go
git commit -m "Automatic version bump to ${{ steps.tag_generation.outputs.new_tag }}"
git commit -m "Automatic version bump to v${{ steps.version.outputs.new-tag }}"
git push origin main
shell: bash

- name: Publish tag on github
run: |
git tag ${{ steps.tag_generation.outputs.new_tag }}
git push origin ${{ steps.tag_generation.outputs.new_tag }}
git tag v${{ steps.version.outputs.new-tag }}
git push origin v${{ steps.version.outputs.new-tag }}
shell: bash

- name: Run go list
run: |
GOPROXY=proxy.golang.org go list -m github.com/firebolt-db/firebolt-go-sdk@${{ steps.tag_generation.outputs.new_tag }}
GOPROXY=proxy.golang.org go list -m github.com/firebolt-db/firebolt-go-sdk@v${{ steps.version.outputs.new-tag }}
shell: bash