-
Notifications
You must be signed in to change notification settings - Fork 20
Adding real versions to the artifact during build in the workflows #215
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
Open
shawn-hurley
wants to merge
2
commits into
konveyor:main
Choose a base branch
from
shawn-hurley:issue/issue-59
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.
+483
−240
Open
Changes from all commits
Commits
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 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| name: Post-Release Version Bump | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*' | ||
|
|
||
| jobs: | ||
| bump-version: | ||
| name: Bump to next SNAPSHOT version | ||
| runs-on: ubuntu-latest | ||
| # Only bump for final releases (skip pre-releases like v0.9.2-rc.1) | ||
| if: ${{ !contains(github.ref_name, '-') }} | ||
|
|
||
| steps: | ||
| - name: Get Token | ||
| id: get_workflow_token | ||
| uses: peter-murray/workflow-application-token-action@v3 | ||
| with: | ||
| application_id: ${{ vars.KONVEYOR_BOT_ID }} | ||
| application_private_key: ${{ secrets.KONVEYOR_BOT_KEY }} | ||
|
|
||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: main | ||
| token: ${{ steps.get_workflow_token.outputs.token }} | ||
|
|
||
| - name: Set up JDK 21 | ||
| uses: actions/setup-java@v5 | ||
| with: | ||
| java-version: '21' | ||
| distribution: 'temurin' | ||
| cache: maven | ||
|
|
||
| - name: Calculate next version | ||
| id: next_version | ||
| run: | | ||
| # Same translation logic as image-build.yaml | ||
| # Anchor: v0.9.1 == 1.0.0 | ||
| translate_version() { | ||
| local raw="$1" base | ||
| IFS='.' read -r major minor patch <<< "$raw" | ||
| if [[ "$major" -ge 1 ]]; then | ||
| echo "${raw}" | ||
| elif [[ "$minor" -ge 10 ]]; then | ||
| echo "1.$((minor - 9)).${patch}" | ||
| elif [[ "$minor" -eq 9 && "$patch" -ge 1 ]]; then | ||
| echo "1.0.$((patch - 1))" | ||
| else | ||
| echo "${raw}" | ||
| fi | ||
| } | ||
|
|
||
| RAW_VERSION="${GITHUB_REF_NAME#v}" | ||
| RELEASE_VERSION=$(translate_version "$RAW_VERSION") | ||
| IFS='.' read -r MAJOR MINOR PATCH <<< "$RELEASE_VERSION" | ||
| NEXT_VERSION="${MAJOR}.$((MINOR + 1)).0-SNAPSHOT" | ||
|
|
||
| echo "raw_version=${RAW_VERSION}" >> $GITHUB_OUTPUT | ||
| echo "release_version=${RELEASE_VERSION}" >> $GITHUB_OUTPUT | ||
| echo "next_version=${NEXT_VERSION}" >> $GITHUB_OUTPUT | ||
| echo "Tag: v${RAW_VERSION} -> released: ${RELEASE_VERSION} -> next dev: ${NEXT_VERSION}" | ||
|
|
||
| - name: Set next SNAPSHOT version in POMs and MANIFESTs | ||
| run: | | ||
| mvn -B org.eclipse.tycho:tycho-versions-plugin:4.0.7:set-version \ | ||
| -DnewVersion=${{ steps.next_version.outputs.next_version }} | ||
|
|
||
| - name: Update Dockerfile ARG defaults | ||
| run: | | ||
| NEXT="${{ steps.next_version.outputs.next_version }}" | ||
| sed -i "s/^ARG BUNDLE_VERSION=.*/ARG BUNDLE_VERSION=${NEXT}/" Dockerfile Dockerfile.test | ||
|
|
||
| - name: Configure git | ||
| run: | | ||
| git config user.name "konveyor-bot[bot]" | ||
| git config user.email "konveyor-bot[bot]@users.noreply.github.com" | ||
|
|
||
| - name: Create branch and commit | ||
| run: | | ||
| NEXT="${{ steps.next_version.outputs.next_version }}" | ||
| BRANCH="chore/bump-version-${NEXT}" | ||
| git checkout -b "$BRANCH" | ||
| git add -A | ||
| git commit --signoff \ | ||
| -m "chore: bump version to ${NEXT} after ${{ github.ref_name }} release" | ||
| git push origin "$BRANCH" | ||
|
|
||
| - name: Create Pull Request | ||
| env: | ||
| GH_TOKEN: ${{ steps.get_workflow_token.outputs.token }} | ||
| run: | | ||
| RAW="${{ steps.next_version.outputs.raw_version }}" | ||
| RELEASE="${{ steps.next_version.outputs.release_version }}" | ||
| NEXT="${{ steps.next_version.outputs.next_version }}" | ||
| gh pr create \ | ||
| --title "chore: bump version to ${NEXT}" \ | ||
| --body "$(cat <<EOF | ||
| ## Post-Release Version Bump | ||
|
|
||
| Automated version bump after the **${{ github.ref_name }}** release. | ||
|
|
||
| - Upstream tag: \`v${RAW}\` | ||
| - Artifact version: \`${RELEASE}\` | ||
| - Next development version: \`${NEXT}\` | ||
|
|
||
| ### Changes | ||
| - Updated all POM versions via \`tycho-versions:set-version\` | ||
| - Updated MANIFEST.MF Bundle-Version (qualifier) | ||
| - Updated Dockerfile ARG defaults | ||
|
|
||
| _This PR was automatically created by the post-release version bump workflow._ | ||
| EOF | ||
| )" \ | ||
| --base main \ | ||
| --head "chore/bump-version-${NEXT}" |
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
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
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
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.