-
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 #7 from dinukaamarasinghe817/main
Add module level build workflow
- Loading branch information
Showing
1 changed file
with
59 additions
and
13 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 |
---|---|---|
@@ -1,18 +1,64 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- '*.md' | ||
- 'docs/**' | ||
|
||
workflow_dispatch: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
- 2201.[0-9]+.x | ||
paths-ignore: | ||
- 'load-tests/**' | ||
- '*.md' | ||
- 'docs/**' | ||
|
||
jobs: | ||
call_workflow: | ||
name: Run Build Workflow | ||
if: ${{ github.repository_owner == 'ballerina-platform' }} | ||
uses: ballerina-platform/ballerina-library/.github/workflows/build-timestamp-master-template.yml@main | ||
secrets: inherit | ||
build: | ||
runs-on: ubuntu-latest | ||
if: github.repository_owner == 'ballerina-platform' | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v2 | ||
with: | ||
distribution: 'temurin' | ||
java-version: 17.0.7 | ||
- name: Change to Timestamped Version | ||
run: | | ||
initialVersion=$((grep -w 'version' | cut -d= -f2) < gradle.properties ) | ||
echo "Initial_Version=$initialVersion" >> $GITHUB_ENV | ||
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: Build with Gradle | ||
env: | ||
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }} | ||
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }} | ||
publishUser: ${{ secrets.BALLERINA_BOT_USERNAME }} | ||
publishPAT: ${{ secrets.BALLERINA_BOT_TOKEN }} | ||
CLIENT_ID: ${{ secrets.CLIENT_ID }} | ||
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} | ||
REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} | ||
run: | | ||
./gradlew clean build publishAllPublicationsToGitHubPackagesRepository --scan --no-daemon | ||
- name: Generate CodeCov Report | ||
uses: codecov/codecov-action@v2 | ||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ballerina-runtime | ||
path: target/ballerina-runtime/ | ||
- name: Revert to SNAPSHOT Version | ||
run: | | ||
echo "version=${{ env.Initial_Version }}" | ||
sed -i "s/version=\(.*\)/version=${{ env.Initial_Version }}/g" gradle.properties | ||
- name: Publish to Nexus | ||
env: | ||
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }} | ||
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }} | ||
nexusUser: ${{ secrets.NEXUS_USERNAME }} | ||
nexusPassword: ${{ secrets.NEXUS_PASSWORD }} | ||
run: | | ||
./gradlew clean publishMavenJavaPublicationToWSO2NexusRepository -x test --scan --no-daemon |