-
Notifications
You must be signed in to change notification settings - Fork 2
Refactor CLI tool with multi-package architecture #9
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
Changes from all commits
1806520
5c58ca5
475e3d1
5a6becc
2cfbb38
add6463
b8c7f9b
525cd9c
fe062e6
2179ac0
53ba1e1
d5ae2cc
742d042
f92a5a3
a440d6b
bb74ffc
160bb78
5e58224
59229d4
281ce76
ac5ee43
4fb5e4f
124abb5
1d982bb
e55843a
700173e
d8d79c6
7bac8f5
7d2f4e2
3d485a0
83dc58a
5f38b70
a7505be
0f25b22
5db8002
64b0bb3
8e0a8bb
8f880b5
e07e080
5ff4815
e195d40
b9fb1eb
e3504fc
f115b06
e38666d
4b9b515
b68cbb3
414d509
6fa87ef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,23 +1,16 @@ | ||
| name: Release | ||
| name: Release Ballerina | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| implementation: | ||
| description: 'Implementation to release' | ||
| required: true | ||
| type: choice | ||
| options: | ||
| - ballerina-interpreter | ||
| - langchain-interpreter | ||
| branch: | ||
| description: 'Branch to release from' | ||
| required: false | ||
| default: 'main' | ||
| type: string | ||
|
|
||
| concurrency: | ||
| group: release-${{ github.event.inputs.implementation }} | ||
| group: release-ballerina-interpreter | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
|
|
@@ -28,6 +21,7 @@ jobs: | |
| outputs: | ||
| release_version: ${{ steps.version.outputs.RELEASE_VERSION }} | ||
| next_version: ${{ steps.version.outputs.NEXT_VERSION }} | ||
| tag: ${{ steps.version.outputs.TAG }} | ||
| steps: | ||
| - name: Validate branch format | ||
| env: | ||
|
|
@@ -47,16 +41,11 @@ jobs: | |
|
|
||
| - name: Read and validate version | ||
| id: version | ||
| env: | ||
| IMPLEMENTATION: ${{ inputs.implementation }} | ||
| run: | | ||
| # Determine version file | ||
| if [ -f "$IMPLEMENTATION/Ballerina.toml" ]; then | ||
| VERSION_FILE="$IMPLEMENTATION/Ballerina.toml" | ||
| elif [ -f "$IMPLEMENTATION/pyproject.toml" ]; then | ||
| VERSION_FILE="$IMPLEMENTATION/pyproject.toml" | ||
| else | ||
| echo "::error::No version file found for implementation: $IMPLEMENTATION" | ||
| VERSION_FILE="ballerina-interpreter/Ballerina.toml" | ||
|
|
||
| if [ ! -f "$VERSION_FILE" ]; then | ||
| echo "::error::Version file not found: $VERSION_FILE" | ||
| exit 1 | ||
| fi | ||
|
|
||
|
|
@@ -74,45 +63,82 @@ jobs: | |
| MINOR=$(echo "$RELEASE_VERSION" | cut -d. -f2) | ||
| PATCH=$(echo "$RELEASE_VERSION" | cut -d. -f3) | ||
| NEXT_VERSION="$MAJOR.$MINOR.$((PATCH + 1))" | ||
| TAG="ballerina-interpreter-v$RELEASE_VERSION" | ||
|
|
||
| echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_OUTPUT | ||
| echo "NEXT_VERSION=$NEXT_VERSION" >> $GITHUB_OUTPUT | ||
| echo "Releasing $RELEASE_VERSION, next will be $NEXT_VERSION" | ||
| echo "TAG=$TAG" >> $GITHUB_OUTPUT | ||
| echo "Releasing ballerina-interpreter $RELEASE_VERSION (tag: $TAG), next will be $NEXT_VERSION" | ||
|
|
||
| - name: Check tag doesn't already exist | ||
| env: | ||
| TAG: ${{ inputs.implementation }}-v${{ steps.version.outputs.RELEASE_VERSION }} | ||
| TAG: ${{ steps.version.outputs.TAG }} | ||
| run: | | ||
| if git rev-parse "$TAG" >/dev/null 2>&1; then | ||
| echo "::error::Tag $TAG already exists. Use re-release workflow to overwrite." | ||
| echo "::error::Tag $TAG already exists." | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Check release branch doesn't already exist | ||
| env: | ||
| RELEASE_BRANCH: release-${{ inputs.implementation }}-${{ steps.version.outputs.RELEASE_VERSION }} | ||
| RELEASE_BRANCH: release-ballerina-interpreter-${{ steps.version.outputs.RELEASE_VERSION }} | ||
| run: | | ||
| if git ls-remote --exit-code --heads origin "$RELEASE_BRANCH" >/dev/null 2>&1; then | ||
| echo "::error::Release branch $RELEASE_BRANCH already exists. Use re-release workflow to overwrite." | ||
| echo "::error::Release branch $RELEASE_BRANCH already exists." | ||
| exit 1 | ||
| fi | ||
|
|
||
| release: | ||
| test: | ||
| needs: validate | ||
| uses: ./.github/workflows/release-common.yml | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: ballerina-interpreter | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ inputs.branch }} | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up Ballerina | ||
| uses: ballerina-platform/setup-ballerina@v1.1.3 | ||
| with: | ||
| version: 2201.12.10 | ||
|
|
||
| - name: Build and test | ||
| run: | | ||
| bal build | ||
| bal test | ||
|
|
||
| docker: | ||
| needs: [validate, test] | ||
| uses: ./.github/workflows/release-docker.yml | ||
| with: | ||
| implementation: ${{ inputs.implementation }} | ||
| context: ballerina-interpreter | ||
| image_name: afm-ballerina-interpreter | ||
| version: ${{ needs.validate.outputs.release_version }} | ||
| branch: ${{ inputs.branch }} | ||
| update_latest: ${{ inputs.branch == 'main' || inputs.branch == 'dev' }} | ||
| is_rerelease: false | ||
| image_title: AFM Ballerina Interpreter | ||
| permissions: | ||
| contents: write | ||
| packages: write | ||
| security-events: write | ||
|
|
||
| finalize: | ||
| needs: [validate, docker] | ||
| uses: ./.github/workflows/release-finalize.yml | ||
| with: | ||
| tag: ${{ needs.validate.outputs.tag }} | ||
| implementation: ballerina-interpreter | ||
| package: ballerina-interpreter | ||
| version: ${{ needs.validate.outputs.release_version }} | ||
| branch: ${{ inputs.branch }} | ||
| is_rerelease: false | ||
| permissions: | ||
| contents: write | ||
|
|
||
| bump-version: | ||
| needs: [validate, release] | ||
| needs: [validate, finalize] | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
|
|
@@ -125,20 +151,14 @@ jobs: | |
| - name: Bump version to next | ||
| env: | ||
| BRANCH: ${{ inputs.branch }} | ||
| IMPLEMENTATION: ${{ inputs.implementation }} | ||
| NEXT_VERSION: ${{ needs.validate.outputs.next_version }} | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
| git pull origin "$BRANCH" --rebase | ||
| # Determine version file | ||
| if [ -f "$IMPLEMENTATION/Ballerina.toml" ]; then | ||
| VERSION_FILE="$IMPLEMENTATION/Ballerina.toml" | ||
| elif [ -f "$IMPLEMENTATION/pyproject.toml" ]; then | ||
| VERSION_FILE="$IMPLEMENTATION/pyproject.toml" | ||
| fi | ||
|
|
||
|
|
||
| VERSION_FILE="ballerina-interpreter/Ballerina.toml" | ||
| sed -i "s/^version = \".*\"/version = \"$NEXT_VERSION\"/" "$VERSION_FILE" | ||
| git add "$VERSION_FILE" | ||
| git commit -m "Bump $IMPLEMENTATION version to $NEXT_VERSION" | ||
| git commit -m "Bump ballerina-interpreter version to $NEXT_VERSION" | ||
|
Comment on lines
+159
to
+163
Contributor
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. 🧩 Analysis chain🏁 Script executed: # Find Ballerina.toml files in the repository
fd "Ballerina.toml" --type fRepository: wso2/reference-implementations-afm Length of output: 114 🏁 Script executed: # Read the Ballerina.toml file and check for lines matching ^version =
cat ballerina-interpreter/Ballerina.tomlRepository: wso2/reference-implementations-afm Length of output: 1777
Line 160's 📝 Proposed fix — limit replacement to the first match- sed -i "s/^version = \".*\"/version = \"$NEXT_VERSION\"/" "$VERSION_FILE"
+ sed -i '0,/^version = ".*"/{s/^version = ".*"/version = "'"$NEXT_VERSION"'"/}' "$VERSION_FILE"🤖 Prompt for AI Agents |
||
| git push origin "$BRANCH" | ||
Uh oh!
There was an error while loading. Please reload this page.