Skip to content

Commit

Permalink
Merge pull request #37 from RDPerera/main
Browse files Browse the repository at this point in the history
Add separate dev/stage central publish release workflow
  • Loading branch information
RDPerera committed Mar 12, 2024
2 parents 072fa23 + 6534786 commit 163aa3f
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 10 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/dev-stage-central-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Publish to the Ballerina DEV/STAGE Central

on:
workflow_dispatch:
inputs:
environment:
type: choice
description: Select environment
required: true
options:
- DEV CENTRAL
- STAGE CENTRAL

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Set Up Ballerina
uses: ballerina-platform/setup-ballerina@v1.1.0
with:
version: latest

- 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: Grant execute permission for gradlew
run: chmod +x gradlew

- 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 release
- 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 release
11 changes: 1 addition & 10 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
name: Release
name: Publish Release

on:
workflow_dispatch:
inputs:
environment:
type: choice
description: Select environment
required: true
options:
- CENTRAL
- DEV CENTRAL
- STAGE CENTRAL

jobs:
build:
Expand Down

0 comments on commit 163aa3f

Please sign in to comment.