-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from ballerina-platform/build-scripts-fix
Update the Build and Workflow Scripts
- Loading branch information
Showing
8 changed files
with
192 additions
and
84 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Publish timestamp build | ||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
if: github.repository_owner == 'ballerina-platform' | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: 17.0.7 | ||
- name: Change to Timestamped Version | ||
run: | | ||
startTime=$(TZ="Asia/Kolkata" date +'%Y%m%d-%H%M00') | ||
latestCommit=$(git log -n 1 --pretty=format:"%h") | ||
VERSION=$((grep -w 'version' | cut -d= -f2) < gradle.properties | rev | cut --complement -d- -f1 | rev) | ||
updatedVersion=$VERSION-$startTime-$latestCommit | ||
echo $updatedVersion | ||
sed -i "s/version=\(.*\)/version=$updatedVersion/g" gradle.properties | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
- name: Build with Gradle | ||
env: | ||
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }} | ||
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }} | ||
run: | | ||
./gradlew clean build publish --stacktrace --scan --console=plain | ||
- name: Generate CodeCov Report | ||
uses: codecov/codecov-action@v4 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: Central Publish | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
environment: | ||
type: choice | ||
description: Select environment | ||
required: true | ||
options: | ||
- CENTRAL | ||
- DEV CENTRAL | ||
- STAGE CENTRAL | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: 17 | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Build with Gradle | ||
run: | | ||
sed -i 's/version=\(.*\)-SNAPSHOT/version=\1/g' gradle.properties | ||
./gradlew clean build | ||
env: | ||
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }} | ||
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }} | ||
|
||
- name: Build the final Copybook tools package using Ballerina | ||
uses: ballerina-platform/ballerina-action/@2201.8.0 | ||
with: | ||
args: pack ./copybook-tool | ||
env: | ||
JAVA_HOME: /usr/lib/jvm/default-jvm | ||
|
||
- name: Ballerina Central Push | ||
if: ${{ inputs.environment == 'CENTRAL' }} | ||
uses: ballerina-platform/ballerina-action/@2201.8.0 | ||
with: | ||
args: push | ||
env: | ||
WORKING_DIR: ./copybook-tool | ||
BALLERINA_DEV_CENTRAL: false | ||
BALLERINA_STAGE_CENTRAL: false | ||
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }} | ||
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }} | ||
JAVA_HOME: /usr/lib/jvm/default-jvm | ||
BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_ACCESS_TOKEN }} | ||
|
||
- name: Ballerina Central Stage Push | ||
if: ${{ inputs.environment == 'STAGE CENTRAL' }} | ||
uses: ballerina-platform/ballerina-action/@2201.8.0 | ||
with: | ||
args: push | ||
env: | ||
WORKING_DIR: ./copybook-tool | ||
BALLERINA_DEV_CENTRAL: false | ||
BALLERINA_STAGE_CENTRAL: true | ||
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }} | ||
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }} | ||
JAVA_HOME: /usr/lib/jvm/default-jvm | ||
BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_STAGE_ACCESS_TOKEN }} | ||
|
||
- name: Ballerina Central Dev Push | ||
if: ${{ inputs.environment == 'DEV CENTRAL' }} | ||
uses: ballerina-platform/ballerina-action/@2201.8.0 | ||
with: | ||
args: push | ||
env: | ||
WORKING_DIR: ./copybook-tool | ||
BALLERINA_DEV_CENTRAL: true | ||
BALLERINA_STAGE_CENTRAL: false | ||
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }} | ||
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }} | ||
JAVA_HOME: /usr/lib/jvm/default-jvm | ||
BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_DEV_ACCESS_TOKEN }} |
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
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
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
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
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
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