-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] Replaced the latest version tag with a baked-in version (#390)
* Modified `build_docker_nightly` workflow * Set `GH_TOKEN` * A different approach * Use shortened sha * Updated `build_docker_on_release` workflow * Updated `deploy` workflow * Removed fetching version from GitHub * Fixed typo * Reverted changes made to `deploy` workflow * Added `bump_version` workflow * Updated `bump_version` workflow * Added the labeled type * Test different auto commands * comment out the label condition * Try canary command * Added github token * Let's try commands * let's try this solution * Removed couple steps * Set the version_schema * Remove prerelease_suffix * Removed default field * Trying the latest version * seems silly but worth a try * Installed auto as a dev dependency * Bumped version in `package` files * Let's try using npm * Added GH_TOKEN * Installed plugins * Grab the last line * Installed the npm plugin explicitly * Revert "Installed the npm plugin explicitly" This reverts commit 5def864. * Revert "Grab the last line" This reverts commit dfcfccb. * Revert "Installed plugins" This reverts commit ca0c485. * Revert "Added GH_TOKEN" This reverts commit f084501. * Revert "Let's try using npm" This reverts commit 602c6a2. * Revert "Bumped version in `package` files" This reverts commit 3a99f82. * Revert "Installed auto as a dev dependency" This reverts commit 5b9b98d. * Going back to version * Let's see the output * Read in a separate step * Let's try this * try again * Try verbose logs * Really? * ok does this work too? * Getting there * Forgot the GH_TOKEN again * Fixed the missing version * Let's run on pull_request * GH_TOKEN added * Almost there * Try a fix for committing to the same branch * figuring out the right syntax * an alternative appraoch * Let's see what's in there * Let's check this one out * This should do it * It's possible we didn't even needed the branch name * Try this syntax * Bumped version to v0.7.2 * Added a condition to check diff before commiting * Refactor * Added a condition to skip the workflow when increment is empty * Small refactor * Removed the explicit condition and used label condition * Bumped version to v0.7.2 * Updated `pull_request_template` * Reverted changes made to `build_docker_on_release` * Fixed typo --------- Co-authored-by: Neurobagel Bot <neurobagel-bot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
8b29587
commit f3c5210
Showing
5 changed files
with
109 additions
and
18 deletions.
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
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
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,90 @@ | ||
name: bump version | ||
|
||
on: | ||
pull_request: | ||
types: [labeled] | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write # Required to commit changes to PR branches | ||
|
||
jobs: | ||
bump-version: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.label.name == 'release' }} | ||
steps: | ||
- name: Generate a token | ||
id: generate-token | ||
uses: actions/create-github-app-token@v1 | ||
with: | ||
app-id: ${{ vars.NB_BOT_ID }} | ||
private-key: ${{ secrets.NB_BOT_KEY }} | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ steps.generate-token.outputs.token }} | ||
|
||
- name: Download latest auto | ||
run: | | ||
auto_download_url="$(curl -fsSL https://api.github.com/repos/intuit/auto/releases/latest | jq -r '.assets[] | select(.name == "auto-linux.gz") | .browser_download_url')" | ||
wget -O- "$auto_download_url" | gunzip > ~/auto | ||
chmod a+x ~/auto | ||
- name: Get latest release version | ||
id: latest-release | ||
run: | | ||
LATEST_TAG=$(curl -fsSL https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name) | ||
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV | ||
- name: Compute increment | ||
id: compute-increment | ||
run: | | ||
# Run auto to determine version increment (patch, minor, major) | ||
INCREMENT=$(~/auto version) | ||
echo "Increment: $INCREMENT" | ||
echo "INCREMENT=$INCREMENT" >> $GITHUB_ENV | ||
env: | ||
GH_TOKEN: ${{ steps.generate-token.outputs.token }} | ||
|
||
- name: Bump version | ||
id: bump-version | ||
run: | | ||
# Extract the current version from the latest release | ||
VERSION=${{ env.LATEST_TAG }} | ||
VERSION=${VERSION#v} # Remove the "v" prefix if it exists | ||
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION" | ||
# Increment based on the auto output | ||
if [ "${{ env.INCREMENT }}" == "major" ]; then | ||
((MAJOR++)) | ||
MINOR=0 | ||
PATCH=0 | ||
elif [ "${{ env.INCREMENT }}" == "minor" ]; then | ||
((MINOR++)) | ||
PATCH=0 | ||
elif [ "${{ env.INCREMENT }}" == "patch" ]; then | ||
((PATCH++)) | ||
fi | ||
# Construct the new version | ||
NEW_VERSION="v$MAJOR.$MINOR.$PATCH" | ||
echo "New version: $NEW_VERSION" | ||
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV | ||
- name: Update package.json | ||
run: | | ||
jq ".version = \"$NEW_VERSION\"" package.json > package.json.tmp && mv package.json.tmp package.json | ||
env: | ||
GH_TOKEN: ${{ steps.generate-token.outputs.token }} | ||
|
||
- name: Commit and Push Changes | ||
run: | | ||
git config --global user.name "Neurobagel Bot" | ||
git config --global user.email "neurobagel-bot[bot]@users.noreply.github.com" | ||
git diff --quiet package.json || (git add package.json && git commit -m "Bumped version to $NEW_VERSION" && git push origin HEAD:${{ github.head_ref }}) | ||
env: | ||
GH_TOKEN: ${{ steps.generate-token.outputs.token }} |
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
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