Skip to content

Publish Ballerina to OpenAPI package #7

Publish Ballerina to OpenAPI package

Publish Ballerina to OpenAPI package #7

# This workflow is to publish the Ballerina to OpenAPI package to the GitHub.
# This has to be run before releasing the openapi-tool, since the http package
# depends on the Ballerina to OpenAPI package.
name: Publish Ballerina to OpenAPI package
on:
workflow_dispatch:
jobs:
publish-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 17.0.7
- name: Set version env variable
run: echo "VERSION=$((grep -w "ballerinaToOpenAPIVersion" | cut -d= -f2) < gradle.properties | rev | cut --complement -d- -f1 | rev)" >> $GITHUB_ENV
- name: Pre release dependency version update
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: |
echo "Version: ${VERSION}"
git config user.name ${{ secrets.BALLERINA_BOT_USERNAME }}
git config user.email ${{ secrets.BALLERINA_BOT_EMAIL }}
git checkout -b ballerina-to-openapi-release-${VERSION}
sed -i 's/ballerinaToOpenAPIVersion=\(.*\)-SNAPSHOT/ballerinaToOpenAPIVersion=\1/g' gradle.properties
sed -i 's/ballerinaLangVersion=\(.*\)-SNAPSHOT/ballerinaLangVersion=\1/g' gradle.properties
sed -i 's/ballerinaLangVersion=\(.*\)-[0-9]\{8\}-[0-9]\{6\}-.*$/ballerinaLangVersion=\1/g' gradle.properties
git add gradle.properties
git commit -m "Move dependencies to stable version" || echo "No changes to commit"
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Publish artifact
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: |
./gradlew :ballerina-to-openapi:publish
- name: Post release PR
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: |
git push origin ballerina-to-openapi-release-${VERSION}
gh pr create --base ${GITHUB_REF##*/} --title "[Automated] Sync ${GITHUB_REF##*/} after ballerina-to-openapi:${VERSION} release" --body "Sync ${GITHUB_REF##*/} after Ballerina to OpenAPI - ${VERSION} release"