Skip to content

Commit

Permalink
Merge pull request #13 from ballerina-platform/timestamp-build
Browse files Browse the repository at this point in the history
Add timestamp build workflow
  • Loading branch information
TharmiganK authored Aug 16, 2023
2 parents 1629ef8 + b78dc70 commit 7a9f948
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/build-timestamped-master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build

on:
push:
branches:
- main
paths-ignore:
- '*.md'
workflow_dispatch:

jobs:
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: |
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 }}
run: |
./gradlew publish --scan --no-daemon
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: ballerina-runtime
path: target/ballerina-runtime/

0 comments on commit 7a9f948

Please sign in to comment.