-
Notifications
You must be signed in to change notification settings - Fork 896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add GitHub workflow files #7585
Open
pallavisontakke
wants to merge
4
commits into
timescale:main
Choose a base branch
from
pallavisontakke:minor_release_github_action_645
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+77
−15
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Minor release | ||
on: | ||
workflow_dispatch: | ||
|
||
# The workflow needs the permission to push branches | ||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
minor-release: | ||
name: Minor release | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Install Linux Dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install pip | ||
|
||
- name: Install Python Dependencies | ||
run: | | ||
pip install PyGithub requests | ||
|
||
- name: Checkout TimescaleDB | ||
uses: actions/checkout@v4 | ||
|
||
- name: Create PR to main branch for minor release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.ORG_AUTOMATION_TOKEN }} | ||
run: | | ||
git remote --verbose | ||
scripts/release/create_minor_release_PR_commit.sh | ||
|
||
- name: Create release branch for minor release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.ORG_AUTOMATION_TOKEN }} | ||
run: | | ||
git remote --verbose | ||
scripts/release/create_minor_release_branch.sh | ||
|
||
- name: Create PR to release branch for minor release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.ORG_AUTOMATION_TOKEN }} | ||
run: | | ||
git remote --verbose | ||
scripts/release/create_minor_release_PR_commit.sh |
This file contains 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
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -2,11 +2,10 @@ | |||||
set -eu | ||||||
|
||||||
# Folder, where we have cloned repositories' sources | ||||||
SOURCES_DIR="sources" | ||||||
SOURCES_DIR="timescaledb" | ||||||
|
||||||
GH_USERNAME=$(gh auth status | grep 'Logged in to' |cut -d ' ' -f 9) | ||||||
|
||||||
FORK_DIR="$GH_USERNAME-timescaledb" | ||||||
#folder-name | ||||||
FORK_DIR="timescaledb" | ||||||
|
||||||
echo "---- Deriving the release related versions from main ----" | ||||||
|
||||||
|
@@ -17,6 +16,8 @@ NEW_PATCH_VERSION="0" | |||||
NEW_VERSION=$(head -1 version.config | cut -d ' ' -f 3 | cut -d '-' -f 1) | ||||||
RELEASE_BRANCH="${NEW_VERSION/%.$NEW_PATCH_VERSION/.x}" | ||||||
CURRENT_VERSION=$(tail -1 version.config | cut -d ' ' -f 3) | ||||||
CURRENT_MINOR_VERSION=$(echo $NEW_VERSION | cut -d '.' -f 2) | ||||||
NEW_MINOR_VERSION=$((CURRENT_MINOR_VERSION + 1)) | ||||||
cd sql/updates | ||||||
|
||||||
for f in ./* | ||||||
|
@@ -29,26 +30,34 @@ done | |||||
LAST_VERSION=$(echo "$LAST_UPDATE_FILE" |cut -d '-' -f 1 |cut -d '/' -f 2) | ||||||
|
||||||
echo "CURRENT_VERSION is $CURRENT_VERSION" | ||||||
#echo "LAST_UPDATE_FILE is $LAST_UPDATE_FILE" | ||||||
echo "LAST_VERSION is $LAST_VERSION" | ||||||
echo "RELEASE_BRANCH is $RELEASE_BRANCH" | ||||||
echo "NEW_VERSION is $NEW_VERSION" | ||||||
cd ~/"$SOURCES_DIR"/"$FORK_DIR" | ||||||
|
||||||
|
||||||
# Derived Variables | ||||||
#RELEASE_PR_BRANCH="release-$NEW_VERSION-$RELEASE_BRANCH" | ||||||
RELEASE_PR_BRANCH="release-$NEW_VERSION" | ||||||
RELEASE_PR_BRANCH="release/$NEW_VERSION" | ||||||
UPDATE_FILE="$CURRENT_VERSION--$NEW_VERSION.sql" | ||||||
DOWNGRADE_FILE="$NEW_VERSION--$CURRENT_VERSION.sql" | ||||||
LAST_UPDATE_FILE="$LAST_VERSION--$CURRENT_VERSION.sql" | ||||||
LAST_DOWNGRADE_FILE="$CURRENT_VERSION--$LAST_VERSION.sql" | ||||||
|
||||||
RELEASE_BRANCH_EXISTS=$(git branch -a |grep -c "origin/$RELEASE_BRANCH"|cut -d ' ' -f 1) | ||||||
|
||||||
if [[ $RELEASE_BRANCH_EXISTS == '0' ]]; then | ||||||
echo "git branch '$RELEASE_BRANCH' does not exist in the remote repository, yet" | ||||||
echo "We want to raise this PR against main" | ||||||
RELEASE_BRANCH="main" | ||||||
RELEASE_PR_BRANCH="$RELEASE_PR_BRANCH-to-main" | ||||||
fi | ||||||
|
||||||
echo "final RELEASE_BRANCH is $RELEASE_BRANCH" | ||||||
echo "RELEASE_PR_BRANCH is $RELEASE_PR_BRANCH" | ||||||
|
||||||
echo "---- Creating release branch $RELEASE_PR_BRANCH from $RELEASE_BRANCH, on the fork ----" | ||||||
|
||||||
git checkout -b "$RELEASE_PR_BRANCH" upstream/"$RELEASE_BRANCH" | ||||||
#git checkout -b "$RELEASE_PR_BRANCH" upstream/main | ||||||
git checkout -b "$RELEASE_PR_BRANCH" origin/"$RELEASE_BRANCH" | ||||||
git branch | ||||||
git pull && git diff HEAD | ||||||
|
||||||
|
@@ -129,6 +138,15 @@ done | |||||
|
||||||
cd .. | ||||||
|
||||||
|
||||||
if [[ $RELEASE_BRANCH_EXISTS == '0' ]]; then | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Nit. |
||||||
echo "---- Modifying version.config to the new versions , if current PR is for main----" | ||||||
sed -i.bak "s/${NEW_VERSION}/${NEW_VERSION}-dev/g" version.config | ||||||
sed -i.bak "s/${CURRENT_MINOR_VERSION}/${NEW_MINOR_VERSION}/g" version.config | ||||||
sed -i.bak "s/${CURRENT_VERSION}/${NEW_VERSION}/g" version.config | ||||||
rm version.config.bak | ||||||
fi | ||||||
|
||||||
git diff HEAD --name-only | ||||||
|
||||||
|
||||||
|
This file contains 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this script can also create the release branch? I think that for ease of understanding, we should choose one of these options:
I think if the branch can be created by two different scripts, it might become confusing, especially since they can diverge subtly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script does not create the release branch. It checks if the release branch is created.
If release-branch exists:
If release-branch does not exist:
i.e. overall through this action, we want to create 2 PRs & 1 release-branch, for each minor release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I think I understand. Can we make this depend on the argument instead? I.e. if you pass it "main" as an argument, it creates the PR to main branch, and if you pass the name of the release branch, it creates a PR to there. This will make it easier to retry any of the steps, i.e. if the release branch was created, but the PR to main failed for some reason, and we need to create it again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit.