Skip to content

Publish Single Connector to the Ballerina Dev\Stage Central #7

Publish Single Connector to the Ballerina Dev\Stage Central

Publish Single Connector to the Ballerina Dev\Stage Central #7

name: Publish Single Connector to the Ballerina Dev\Stage Central
on:
workflow_dispatch:
inputs:
environment:
type: choice
description: Select Environment
required: true
options:
- DEV CENTRAL
- STAGE CENTRAL
connector:
type: choice
description: Select Connector
required: true
options:
- api_salesdistrict_srv
- api_salesorganization_srv
- api_sales_order_srv
- api_sd_sa_soldtopartydetn
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/[email protected]
with:
version: ${{ env.BAL_VERSION }}
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: 17.0.7
- 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 :sales-ballerina:${{ inputs.connector}}:build -x :sales-examples:test -PpublishToCentral=true
- 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 :sales-ballerina:${{ inputs.connector }}:build -x :sales-examples:test -PpublishToCentral=true