From d613eccb0ea4a81145d50929b0260c8a7f63510f Mon Sep 17 00:00:00 2001 From: Dilan Sachintha Nayanajith Date: Tue, 3 Oct 2023 21:08:11 +0530 Subject: [PATCH 1/4] Update build-timestamped-master.yml --- .../workflows/build-timestamped-master.yml | 35 +++---------------- 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/.github/workflows/build-timestamped-master.yml b/.github/workflows/build-timestamped-master.yml index 0a1a528..73645aa 100644 --- a/.github/workflows/build-timestamped-master.yml +++ b/.github/workflows/build-timestamped-master.yml @@ -6,33 +6,8 @@ on: 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: 'adopt' - 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 }} - publishUser: ${{ secrets.BALLERINA_BOT_USERNAME }} - publishPAT: ${{ secrets.BALLERINA_BOT_TOKEN }} - run: | - ./gradlew clean build publish --stacktrace --scan --console=plain - - name: Generate CodeCov Report - uses: codecov/codecov-action@v1 + call_workflow: + name: Run Build Workflow + if: ${{ github.repository_owner == 'ballerina-platform' }} + uses: ballerina-platform/ballerina-standard-library/.github/workflows/build-timestamp-master-template.yml@main + secrets: inherit From e1969b53c714e449188371b2f616bd59160e0a53 Mon Sep 17 00:00:00 2001 From: Dilan Sachintha Nayanajith Date: Tue, 3 Oct 2023 21:09:18 +0530 Subject: [PATCH 2/4] Update publish-release.yml --- .github/workflows/publish-release.yml | 53 ++++----------------------- 1 file changed, 8 insertions(+), 45 deletions(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 0cdd2eb..3c56a74 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -4,48 +4,11 @@ on: workflow_dispatch: jobs: - publish-release: - 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: 'adopt' - java-version: 17.0.7 - - name: Set version env variable - run: echo "VERSION=$((grep -w "version" | cut -d= -f2) < gradle.properties | rev | cut --complement -d- -f1 | rev)" >> $GITHUB_ENV - - name: Pre release depenency version update - env: - GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} - run: | - echo "Version: ${VERSION}" - git config user.name ${{ secrets.BALLERINA_BOT_USERNAME }} - git config user.email ${{ secrets.BALLERINA_BOT_EMAIL }} - git checkout -b release-${VERSION} - sed -i 's/ballerinaLangVersion=\(.*\)-SNAPSHOT/ballerinaLangVersion=\1/g' gradle.properties - sed -i 's/ballerinaLangVersion=\(.*\)-[0-9]\{8\}-[0-9]\{6\}-.*$/ballerinaLangVersion=\1/g' gradle.properties - sed -i 's/stdlib\(.*\)=\(.*\)-SNAPSHOT/stdlib\1=\2/g' gradle.properties - sed -i 's/stdlib\(.*\)=\(.*\)-[0-9]\{8\}-[0-9]\{6\}-.*$/stdlib\1=\2/g' gradle.properties - git add gradle.properties - git commit -m "Move dependencies to stable version" || echo "No changes to commit" - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Publish artifact - env: - GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} - BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_ACCESS_TOKEN }} - packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }} - packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }} - publishUser: ${{ secrets.BALLERINA_BOT_USERNAME }} - publishPAT: ${{ secrets.BALLERINA_BOT_TOKEN }} - run: | - ./gradlew release -Prelease.useAutomaticVersion=true - ./gradlew -Pversion=${VERSION} publish -x test - - name: GitHub Release and Release Sync PR - env: - GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} - run: | - gh release create v$VERSION --title "protoc-tool-v$VERSION" - gh pr create --title "[Automated] Sync main after $VERSION release" --body "Sync main after $VERSION release" + call_workflow: + name: Run Release Workflow + if: ${{ github.repository_owner == 'ballerina-platform' }} + uses: ballerina-platform/ballerina-standard-library/.github/workflows/release-package-template.yml@main + secrets: inherit + with: + package-name: protoc-tools + package-org: ballerina From 537373c95d04e2ce4e01788f9df07d00c480614b Mon Sep 17 00:00:00 2001 From: Dilan Sachintha Nayanajith Date: Tue, 3 Oct 2023 21:09:56 +0530 Subject: [PATCH 3/4] Update pull-request.yml --- .github/workflows/pull-request.yml | 41 ++++++------------------------ 1 file changed, 8 insertions(+), 33 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index d6e239e..b79d9d1 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -1,38 +1,13 @@ name: PR build +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: true + on: pull_request jobs: - ubuntu-build: - name: Build on Ubuntu - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 17 - uses: actions/setup-java@v2 - with: - distribution: 'temurin' - java-version: 17.0.7 - - name: Build with Gradle - env: - packageUser: ${{ github.actor }} - packagePAT: ${{ secrets.GITHUB_TOKEN }} - run: ./gradlew build - - name: Generate CodeCov Report - if: github.event_name == 'pull_request' - uses: codecov/codecov-action@v2 - - windows-build: - name: Build on Windows - runs-on: windows-latest - steps: - - uses: actions/checkout@v1 - - name: Set up JDK 17 - uses: actions/setup-java@v1 - with: - java-version: 17.0.7 - - name: Build with Gradle - env: - packageUser: ${{ github.actor }} - packagePAT: ${{ secrets.GITHUB_TOKEN }} - run: ./gradlew.bat build + call_workflow: + name: Run PR Build Workflow + if: ${{ github.repository_owner == 'ballerina-platform' }} + uses: ballerina-platform/ballerina-standard-library/.github/workflows/pull-request-build-template.yml@main From ce6ce164c59d178f729fae24b586b1bc78720125 Mon Sep 17 00:00:00 2001 From: Dilan Sachintha Nayanajith Date: Wed, 4 Oct 2023 11:46:29 +0530 Subject: [PATCH 4/4] Update .github/workflows/pull-request.yml Co-authored-by: MohamedSabthar --- .github/workflows/pull-request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index b79d9d1..5cdb8f7 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -1,4 +1,4 @@ -name: PR build +name: PR Build concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}