Publish to the Ballerina DEV/STAGE Central (Connector) #4
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
name: Publish to the Ballerina DEV/STAGE Central (Connector) | |
on: | |
workflow_dispatch: | |
inputs: | |
environment: | |
type: choice | |
description: Select Environment | |
required: true | |
options: | |
- DEV CENTRAL | |
- STAGE CENTRAL | |
jobs: | |
publish-release: | |
runs-on: ubuntu-latest | |
if: github.repository_owner == 'ballerina-platform' | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Get Ballerina Version | |
run: | | |
BAL_VERSION=$(grep -w 'ballerinaLangVersion' gradle.properties | cut -d= -f2 | rev | cut --complement -d- -f1 | rev) | |
if [ -z "$BAL_VERSION" ]; then | |
BAL_VERSION="latest" | |
fi | |
echo "BAL_VERSION=$BAL_VERSION" >> $GITHUB_ENV | |
echo "Ballerina Version: $BAL_VERSION" | |
- name: Set Up Ballerina | |
uses: ballerina-platform/setup-ballerina@v1.1.2 | |
with: | |
version: ${{ env.BAL_VERSION }} | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: "temurin" | |
java-version: 21.0.3 | |
- name: Set ENV Variables | |
run: | | |
echo -e '${{ toJson(secrets) }}' | jq -r 'to_entries[] | .key + "=" + .value' >> $GITHUB_ENV | |
- name: Ballerina Central Dev Push | |
if: ${{ inputs.environment == 'DEV CENTRAL' }} | |
env: | |
BALLERINA_DEV_CENTRAL: true | |
BALLERINA_STAGE_CENTRAL: false | |
BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_DEV_ACCESS_TOKEN }} | |
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }} | |
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} | |
run: | | |
sed -i 's/version=\(.*\)-SNAPSHOT/version=\1/g' gradle.properties | |
./gradlew clean build -PpublishToCentral=true ${{ inputs.additional-publish-flags }} | |
- name: Ballerina Central Stage Push | |
if: ${{ inputs.environment == 'STAGE CENTRAL' }} | |
env: | |
BALLERINA_DEV_CENTRAL: false | |
BALLERINA_STAGE_CENTRAL: true | |
BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_STAGE_ACCESS_TOKEN }} | |
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }} | |
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} | |
run: | | |
sed -i 's/version=\(.*\)-SNAPSHOT/version=\1/g' gradle.properties | |
./gradlew clean build -PpublishToCentral=true ${{ inputs.additional-publish-flags }} |