1- name : Release
1+ name : Release Ballerina
22
33on :
44 workflow_dispatch :
55 inputs :
6- implementation :
7- description : ' Implementation to release'
8- required : true
9- type : choice
10- options :
11- - ballerina-interpreter
12- - langchain-interpreter
136 branch :
147 description : ' Branch to release from'
158 required : false
169 default : ' main'
1710 type : string
1811
1912concurrency :
20- group : release-${{ github.event.inputs.implementation }}
13+ group : release-ballerina-interpreter
2114 cancel-in-progress : false
2215
2316jobs :
2821 outputs :
2922 release_version : ${{ steps.version.outputs.RELEASE_VERSION }}
3023 next_version : ${{ steps.version.outputs.NEXT_VERSION }}
24+ tag : ${{ steps.version.outputs.TAG }}
3125 steps :
3226 - name : Validate branch format
3327 env :
@@ -47,16 +41,11 @@ jobs:
4741
4842 - name : Read and validate version
4943 id : version
50- env :
51- IMPLEMENTATION : ${{ inputs.implementation }}
5244 run : |
53- # Determine version file
54- if [ -f "$IMPLEMENTATION/Ballerina.toml" ]; then
55- VERSION_FILE="$IMPLEMENTATION/Ballerina.toml"
56- elif [ -f "$IMPLEMENTATION/pyproject.toml" ]; then
57- VERSION_FILE="$IMPLEMENTATION/pyproject.toml"
58- else
59- echo "::error::No version file found for implementation: $IMPLEMENTATION"
45+ VERSION_FILE="ballerina-interpreter/Ballerina.toml"
46+
47+ if [ ! -f "$VERSION_FILE" ]; then
48+ echo "::error::Version file not found: $VERSION_FILE"
6049 exit 1
6150 fi
6251
@@ -74,45 +63,82 @@ jobs:
7463 MINOR=$(echo "$RELEASE_VERSION" | cut -d. -f2)
7564 PATCH=$(echo "$RELEASE_VERSION" | cut -d. -f3)
7665 NEXT_VERSION="$MAJOR.$MINOR.$((PATCH + 1))"
66+ TAG="ballerina-interpreter-v$RELEASE_VERSION"
7767
7868 echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_OUTPUT
7969 echo "NEXT_VERSION=$NEXT_VERSION" >> $GITHUB_OUTPUT
80- echo "Releasing $RELEASE_VERSION, next will be $NEXT_VERSION"
70+ echo "TAG=$TAG" >> $GITHUB_OUTPUT
71+ echo "Releasing ballerina-interpreter $RELEASE_VERSION (tag: $TAG), next will be $NEXT_VERSION"
8172
8273 - name : Check tag doesn't already exist
8374 env :
84- TAG : ${{ inputs.implementation }}-v${{ steps.version.outputs.RELEASE_VERSION }}
75+ TAG : ${{ steps.version.outputs.TAG }}
8576 run : |
8677 if git rev-parse "$TAG" >/dev/null 2>&1; then
87- echo "::error::Tag $TAG already exists. Use re-release workflow to overwrite. "
78+ echo "::error::Tag $TAG already exists."
8879 exit 1
8980 fi
9081
9182 - name : Check release branch doesn't already exist
9283 env :
93- RELEASE_BRANCH : release-${{ inputs.implementation }} -${{ steps.version.outputs.RELEASE_VERSION }}
84+ RELEASE_BRANCH : release-ballerina-interpreter -${{ steps.version.outputs.RELEASE_VERSION }}
9485 run : |
9586 if git ls-remote --exit-code --heads origin "$RELEASE_BRANCH" >/dev/null 2>&1; then
96- echo "::error::Release branch $RELEASE_BRANCH already exists. Use re-release workflow to overwrite. "
87+ echo "::error::Release branch $RELEASE_BRANCH already exists."
9788 exit 1
9889 fi
9990
100- release :
91+ test :
10192 needs : validate
102- uses : ./.github/workflows/release-common.yml
93+ runs-on : ubuntu-latest
94+ defaults :
95+ run :
96+ working-directory : ballerina-interpreter
97+ steps :
98+ - name : Checkout repository
99+ uses : actions/checkout@v4
100+ with :
101+ ref : ${{ inputs.branch }}
102+ fetch-depth : 0
103+
104+ - name : Set up Ballerina
105+ uses : ballerina-platform/setup-ballerina@v1.1.3
106+ with :
107+ version : 2201.12.10
108+
109+ - name : Build and test
110+ run : |
111+ bal build
112+ bal test
113+
114+ docker :
115+ needs : [validate, test]
116+ uses : ./.github/workflows/release-docker.yml
103117 with :
104- implementation : ${{ inputs.implementation }}
118+ context : ballerina-interpreter
119+ image_name : afm-ballerina-interpreter
105120 version : ${{ needs.validate.outputs.release_version }}
106121 branch : ${{ inputs.branch }}
107- update_latest : ${{ inputs.branch == 'main' || inputs.branch == 'dev' }}
108- is_rerelease : false
122+ image_title : AFM Ballerina Interpreter
109123 permissions :
110- contents : write
111124 packages : write
112125 security-events : write
113126
127+ finalize :
128+ needs : [validate, docker]
129+ uses : ./.github/workflows/release-finalize.yml
130+ with :
131+ tag : ${{ needs.validate.outputs.tag }}
132+ implementation : ballerina-interpreter
133+ package : ballerina-interpreter
134+ version : ${{ needs.validate.outputs.release_version }}
135+ branch : ${{ inputs.branch }}
136+ is_rerelease : false
137+ permissions :
138+ contents : write
139+
114140 bump-version :
115- needs : [validate, release ]
141+ needs : [validate, finalize ]
116142 runs-on : ubuntu-latest
117143 permissions :
118144 contents : write
@@ -125,20 +151,14 @@ jobs:
125151 - name : Bump version to next
126152 env :
127153 BRANCH : ${{ inputs.branch }}
128- IMPLEMENTATION : ${{ inputs.implementation }}
129154 NEXT_VERSION : ${{ needs.validate.outputs.next_version }}
130155 run : |
131156 git config user.name "github-actions[bot]"
132157 git config user.email "github-actions[bot]@users.noreply.github.com"
133158 git pull origin "$BRANCH" --rebase
134- # Determine version file
135- if [ -f "$IMPLEMENTATION/Ballerina.toml" ]; then
136- VERSION_FILE="$IMPLEMENTATION/Ballerina.toml"
137- elif [ -f "$IMPLEMENTATION/pyproject.toml" ]; then
138- VERSION_FILE="$IMPLEMENTATION/pyproject.toml"
139- fi
140-
159+
160+ VERSION_FILE="ballerina-interpreter/Ballerina.toml"
141161 sed -i "s/^version = \".*\"/version = \"$NEXT_VERSION\"/" "$VERSION_FILE"
142162 git add "$VERSION_FILE"
143- git commit -m "Bump $IMPLEMENTATION version to $NEXT_VERSION"
163+ git commit -m "Bump ballerina-interpreter version to $NEXT_VERSION"
144164 git push origin "$BRANCH"
0 commit comments