From 356c1dbe28d347647d9c46fed65683c27e8c9bb0 Mon Sep 17 00:00:00 2001 From: Thisaru Guruge Date: Wed, 9 Aug 2023 16:45:54 +0530 Subject: [PATCH] Add release workflow --- .github/workflows/publish-release.yml | 57 +++++++++++++++++++++++++++ main.sh | 0 2 files changed, 57 insertions(+) create mode 100644 .github/workflows/publish-release.yml mode change 100644 => 100755 main.sh diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml new file mode 100644 index 0000000..c344769 --- /dev/null +++ b/.github/workflows/publish-release.yml @@ -0,0 +1,57 @@ +name: Publish Release + +on: + workflow_dispatch + +jobs: + publish-release: + name: Release Package + runs-on: ubuntu-latest + if: github.repository_owner == 'xlibb' + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: 11 + + - name: Build with Gradle + 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 + + - name: Get Release Version + run: echo "VERSION=$((grep -w 'version' | cut -d= -f2) < gradle.properties | rev | cut --complement -d- -f1 | rev)" >> $GITHUB_ENV + + - name: Pre release dependency version update + env: + GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} + run: | + echo "Version: ${VERSION}" + git checkout -b release-${VERSION} + + - 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 + + - name: GitHub Release and Release Sync PR + env: + GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} + run: | + gh release create v$VERSION --title "GraphQL-Federation-Gateway-v$VERSION" + gh pr create --title "[Automated] Sync master after $VERSION release" --body "Sync master after $VERSION release" diff --git a/main.sh b/main.sh old mode 100644 new mode 100755