Skip to content

Commit

Permalink
Merge pull request #4857 from MohamedSabthar/workflow-mig
Browse files Browse the repository at this point in the history
  • Loading branch information
ThisaruGuruge authored Sep 27, 2023
2 parents af27bf1 + 5892603 commit 072b5a6
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 1 deletion.
68 changes: 68 additions & 0 deletions .github/workflows/release-package-connector-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Publish Release (Connector)

on:
workflow_call:
inputs:
package-name:
required: true
type: string
package-org:
required: true
type: string
additional-build-flags:
required: false
type: string
default: ""
additional-publish-flags:
required: false
type: string
default: ""

jobs:
publish-release:
name: Release Package
runs-on: ubuntu-latest
if: github.repository_owner == 'ballerina-platform'
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17.0.7

- name: Build without Tests
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name ${{ secrets.BALLERINA_BOT_USERNAME }}
git config --global user.email ${{ secrets.BALLERINA_BOT_EMAIL }}
./gradlew build -x check -x test ${{ inputs.additional-build-flags }}
- name: Create lib Directory if not Exists
run: mkdir -p ballerina/lib

- name: Get Release Version
run: echo "VERSION=$((grep -w 'version' | cut -d= -f2) < gradle.properties | rev | cut --complement -d- -f1 | rev)" >> $GITHUB_ENV

- name: Publish Package
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 clean release -Prelease.useAutomaticVersion=true
./gradlew -Pversion=${VERSION} publish -x test -PpublishToCentral=true ${{ inputs.additional-publish-flags }}
- name: GitHub Release and Release Sync PR
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: |
gh release create v$VERSION --title "module-${{ inputs.package-org }}-${{ inputs.package-name }}-v$VERSION"
gh pr create --base ${GITHUB_REF##*/} --title "[Automated] Sync ${GITHUB_REF##*/} after $VERSION release" --body "Sync ${GITHUB_REF##*/} after $VERSION release"
2 changes: 1 addition & 1 deletion .github/workflows/release-package-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@ jobs:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: |
gh release create v$VERSION --title "module-${{ inputs.package-org }}-${{ inputs.package-name }}-v$VERSION"
gh pr create --title "[Automated] Sync master after $VERSION release" --body "Sync master after $VERSION release"
gh pr create --base ${GITHUB_REF##*/} --title "[Automated] Sync ${GITHUB_REF##*/} after $VERSION release" --body "Sync ${GITHUB_REF##*/} after $VERSION release"

0 comments on commit 072b5a6

Please sign in to comment.