From 89328907d8e174ca56f3ba368d43f30202975f0b Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Mon, 30 Sep 2024 13:08:28 +0530 Subject: [PATCH 01/20] initial commit --- .github/workflows/publish.yml | 34 ++++++++++++++++++++++++++++++++++ pom.xml | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..c020c861 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,34 @@ +name: Java Build, Lint and Test + +on: + push: + release: + types: [published] + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout Xero-Java repo + uses: actions/checkout@v4 + with: + repository: XeroAPI/Xero-Java + path: Xero-Java + + - name: Set up JDK environment + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '11' + cache: maven + + - name: Import GPG Key + run: | + echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import + env: + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY}} + + - name: Publish to Maven + run: mvn clean deploy -P release -DskipTests=true -Dusername=${{ secrets.MAVEN_USERNAME }} -Dpassword=${{ secrets.MAVEN_TOKEN }} + working-directory: Xero-Java diff --git a/pom.xml b/pom.xml index 73939d89..a8d5f4f7 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ xero-java jar xero-java - 8.3.0 + 8.3.0-alpha.1 https://github.com/XeroAPI/Xero-Java This is the official Java SDK for Xero API From 86faf0abe66ed47a63b296106517b33e0621a2b9 Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Mon, 30 Sep 2024 13:10:37 +0530 Subject: [PATCH 02/20] export gpg key --- .github/workflows/publish.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c020c861..835e7ce3 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,5 +1,4 @@ -name: Java Build, Lint and Test - +name: Publish on: push: release: @@ -30,5 +29,7 @@ jobs: GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY}} - name: Publish to Maven - run: mvn clean deploy -P release -DskipTests=true -Dusername=${{ secrets.MAVEN_USERNAME }} -Dpassword=${{ secrets.MAVEN_TOKEN }} + run: | + export GPG_TTY=$(tty) + mvn clean deploy -P release -DskipTests=true -Dusername=${{ secrets.MAVEN_USERNAME }} -Dpassword=${{ secrets.MAVEN_TOKEN }} working-directory: Xero-Java From ac44e53a9947141261e599361104cc2d907bebcc Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Mon, 30 Sep 2024 13:12:09 +0530 Subject: [PATCH 03/20] adds gpg passphrase as one input --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 835e7ce3..f32c14cf 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -31,5 +31,5 @@ jobs: - name: Publish to Maven run: | export GPG_TTY=$(tty) - mvn clean deploy -P release -DskipTests=true -Dusername=${{ secrets.MAVEN_USERNAME }} -Dpassword=${{ secrets.MAVEN_TOKEN }} + mvn clean deploy -P release -DskipTests=true -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} -Dusername=${{ secrets.MAVEN_USERNAME }} -Dpassword=${{ secrets.MAVEN_TOKEN }} working-directory: Xero-Java From d1936283fe70fd064379aef1e3780cd56f10668f Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Mon, 30 Sep 2024 13:15:34 +0530 Subject: [PATCH 04/20] adds a step to configure maven settings --- .github/workflows/publish.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f32c14cf..27420952 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -28,8 +28,21 @@ jobs: env: GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY}} + - name: Configure Maven settings + run: | + mkdir -p ~/.m2 + echo " + + + ossrh + ${{ secrets.MAVEN_USERNAME }} + ${{ secrets.MAVEN_TOKEN }} + + + " > ~/.m2/settings.xml + - name: Publish to Maven run: | export GPG_TTY=$(tty) - mvn clean deploy -P release -DskipTests=true -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} -Dusername=${{ secrets.MAVEN_USERNAME }} -Dpassword=${{ secrets.MAVEN_TOKEN }} + mvn clean deploy -DskipTests=true -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} working-directory: Xero-Java From 70e8fda681940d5e25a7f39eaa1450bcfdc4223b Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Mon, 30 Sep 2024 13:23:31 +0530 Subject: [PATCH 05/20] simplified by having a separate settings.xml file --- .github/settings.xml | 9 +++++++++ .github/workflows/publish.yml | 10 +--------- pom.xml | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) create mode 100644 .github/settings.xml diff --git a/.github/settings.xml b/.github/settings.xml new file mode 100644 index 00000000..291fc175 --- /dev/null +++ b/.github/settings.xml @@ -0,0 +1,9 @@ + + + + ossrh + ${env.MAVEN_USERNAME} + ${env.MAVEN_TOKEN} + + + diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 27420952..f8ab2051 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -31,15 +31,7 @@ jobs: - name: Configure Maven settings run: | mkdir -p ~/.m2 - echo " - - - ossrh - ${{ secrets.MAVEN_USERNAME }} - ${{ secrets.MAVEN_TOKEN }} - - - " > ~/.m2/settings.xml + cp .github/settings.xml ~/.m2/settings.xml - name: Publish to Maven run: | diff --git a/pom.xml b/pom.xml index a8d5f4f7..0bc553b4 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ xero-java jar xero-java - 8.3.0-alpha.1 + 8.3.0-alpha.2 https://github.com/XeroAPI/Xero-Java This is the official Java SDK for Xero API From a15f876cb01f6fb55e37a459917c1808f1eb9cf2 Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Mon, 30 Sep 2024 13:24:19 +0530 Subject: [PATCH 06/20] adds working directory --- .github/workflows/publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f8ab2051..9ea3cb04 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -32,6 +32,7 @@ jobs: run: | mkdir -p ~/.m2 cp .github/settings.xml ~/.m2/settings.xml + working-directory: Xero-Java - name: Publish to Maven run: | From 3c846889f8a3843140e81d32d0b888d86b03cdce Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Mon, 30 Sep 2024 15:11:40 +0530 Subject: [PATCH 07/20] make the pipeline run only when release is created --- .github/workflows/publish.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9ea3cb04..35a18d45 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,6 +1,5 @@ name: Publish on: - push: release: types: [published] @@ -31,8 +30,15 @@ jobs: - name: Configure Maven settings run: | mkdir -p ~/.m2 - cp .github/settings.xml ~/.m2/settings.xml - working-directory: Xero-Java + echo " + + + ossrh + ${{ secrets.MAVEN_USERNAME }} + ${{ secrets.MAVEN_TOKEN }} + + + " > ~/.m2/settings.xml - name: Publish to Maven run: | From f3bfe77fde95ba80cc8eecab0e7685a64589083a Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Mon, 30 Sep 2024 15:25:24 +0530 Subject: [PATCH 08/20] final commit --- .github/settings.xml | 9 --------- pom.xml | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) delete mode 100644 .github/settings.xml diff --git a/.github/settings.xml b/.github/settings.xml deleted file mode 100644 index 291fc175..00000000 --- a/.github/settings.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - ossrh - ${env.MAVEN_USERNAME} - ${env.MAVEN_TOKEN} - - - diff --git a/pom.xml b/pom.xml index 0bc553b4..73939d89 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ xero-java jar xero-java - 8.3.0-alpha.2 + 8.3.0 https://github.com/XeroAPI/Xero-Java This is the official Java SDK for Xero API From d2bc4eb0c89f3765828a677a4405a664989ab93b Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Mon, 30 Sep 2024 15:49:35 +0530 Subject: [PATCH 09/20] corrected review comments --- .github/workflows/publish.yml | 17 ++++------------- pom.xml | 2 +- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 35a18d45..42fc0834 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,5 +1,6 @@ name: Publish on: + push: release: types: [published] @@ -20,6 +21,9 @@ jobs: distribution: 'temurin' java-version: '11' cache: maven + server-id: ossrh + server-username: ${{ secrets.MAVEN_USERNAME }} + server-password: ${{ secrets.MAVEN_TOKEN }} - name: Import GPG Key run: | @@ -27,19 +31,6 @@ jobs: env: GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY}} - - name: Configure Maven settings - run: | - mkdir -p ~/.m2 - echo " - - - ossrh - ${{ secrets.MAVEN_USERNAME }} - ${{ secrets.MAVEN_TOKEN }} - - - " > ~/.m2/settings.xml - - name: Publish to Maven run: | export GPG_TTY=$(tty) diff --git a/pom.xml b/pom.xml index 73939d89..6f79c699 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ xero-java jar xero-java - 8.3.0 + 8.3.0-alpha.3 https://github.com/XeroAPI/Xero-Java This is the official Java SDK for Xero API From 516515d3be81bb8ffecc29413bad72bf807217a7 Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Mon, 30 Sep 2024 15:52:20 +0530 Subject: [PATCH 10/20] corrected getting secrets --- .github/workflows/publish.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 42fc0834..5af89398 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -22,8 +22,8 @@ jobs: java-version: '11' cache: maven server-id: ossrh - server-username: ${{ secrets.MAVEN_USERNAME }} - server-password: ${{ secrets.MAVEN_TOKEN }} + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD - name: Import GPG Key run: | @@ -35,4 +35,7 @@ jobs: run: | export GPG_TTY=$(tty) mvn clean deploy -DskipTests=true -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} + env: + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_TOKEN }} working-directory: Xero-Java From b2240114a16caff3de466dd3533763dc2986cc73 Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Mon, 30 Sep 2024 15:59:33 +0530 Subject: [PATCH 11/20] adds gpg passphrase in secret --- .github/workflows/publish.yml | 4 +++- pom.xml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5af89398..851de1c6 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -24,6 +24,7 @@ jobs: server-id: ossrh server-username: MAVEN_USERNAME server-password: MAVEN_PASSWORD + gpg-passphrase: GPG_PASSPHRASE - name: Import GPG Key run: | @@ -34,8 +35,9 @@ jobs: - name: Publish to Maven run: | export GPG_TTY=$(tty) - mvn clean deploy -DskipTests=true -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} + mvn clean deploy -DskipTests=true env: MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} MAVEN_PASSWORD: ${{ secrets.MAVEN_TOKEN }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} working-directory: Xero-Java diff --git a/pom.xml b/pom.xml index 6f79c699..da6b5ba0 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ xero-java jar xero-java - 8.3.0-alpha.3 + 8.3.0-alpha.4 https://github.com/XeroAPI/Xero-Java This is the official Java SDK for Xero API From ab0cad3e6fc523cfa7afd218eeaa59dfc78f1f70 Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Mon, 30 Sep 2024 16:02:28 +0530 Subject: [PATCH 12/20] corrected build pipeline --- .github/workflows/build-lint-test.yml | 5 ++++- .github/workflows/publish.yml | 1 - pom.xml | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-lint-test.yml b/.github/workflows/build-lint-test.yml index ab8afd94..bebbff41 100644 --- a/.github/workflows/build-lint-test.yml +++ b/.github/workflows/build-lint-test.yml @@ -20,6 +20,7 @@ jobs: distribution: 'temurin' java-version: '11' cache: maven + gpg-passphrase: GPG_PASSPHRASE - name: Import GPG Key run: | @@ -30,5 +31,7 @@ jobs: - name: Build and test post generation run: | export GPG_TTY=$(tty) - mvn clean verify -DskipTests=true -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} + mvn clean verify -DskipTests=true + env: + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} working-directory: Xero-Java diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 851de1c6..abc3ab09 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,6 +1,5 @@ name: Publish on: - push: release: types: [published] diff --git a/pom.xml b/pom.xml index da6b5ba0..73939d89 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ xero-java jar xero-java - 8.3.0-alpha.4 + 8.3.0 https://github.com/XeroAPI/Xero-Java This is the official Java SDK for Xero API From b603234590601eaac7cfb42017b118411f1a0b2b Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Fri, 4 Oct 2024 13:35:26 +0530 Subject: [PATCH 13/20] initial commit --- pom.xml | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/pom.xml b/pom.xml index 73939d89..f7e59959 100644 --- a/pom.xml +++ b/pom.xml @@ -41,7 +41,7 @@ com.auth0 java-jwt - 3.19.4 + 4.4.0 com.auth0 @@ -68,17 +68,17 @@ commons-io commons-io - 2.7 + 2.17.0 jakarta.servlet jakarta.servlet-api - 6.0.0 + 6.1.0 org.mockito mockito-core - 5.10.0 + 5.14.1 test @@ -92,7 +92,7 @@ org.slf4j slf4j-api - 1.7.30 + 2.0.16 @@ -159,7 +159,7 @@ maven-deploy-plugin - 2.8.2 + 3.1.3 org.apache.maven.plugins @@ -208,12 +208,12 @@ org.codehaus.mojo findbugs-maven-plugin - 3.0.4 + 3.0.5 org.apache.maven.plugins maven-war-plugin - 3.1.0 + 3.4.0 example/src/main/webapp/WEB-INF/web.xml @@ -232,7 +232,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.3.2 + 3.10.1 8 @@ -248,7 +248,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.6 + 3.2.7 sign-artifacts @@ -261,7 +261,6 @@ --pinentry-mode loopback - gpg.passphrase @@ -269,7 +268,7 @@ org.sonatype.plugins nexus-staging-maven-plugin - 1.6.13 + 1.7.0 true ossrh @@ -280,7 +279,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0-M4 + 3.5.0 -Duser.timezone=GMT-08:00 @@ -292,12 +291,12 @@ org.apache.maven.plugins maven-pmd-plugin - 3.8 + 3.25.0 org.codehaus.mojo findbugs-maven-plugin - 3.0.4 + 3.0.5 @@ -317,11 +316,11 @@ UTF-8 11 1.6.3 - 2.3.0 + 2.7.0 2.25.1 - 2.16.1 - 2.16.1 - 2.12.5 + 2.18.0 + 2.18.0 + 2.15.2 4.13.2 4.5.3 3.1.5 From 8d914c822db496c54f2c89ed14b1936a5bf1b599 Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Fri, 4 Oct 2024 13:42:39 +0530 Subject: [PATCH 14/20] removed passphrase variable from java installation --- .github/workflows/build-lint-test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-lint-test.yml b/.github/workflows/build-lint-test.yml index bebbff41..89fc65d6 100644 --- a/.github/workflows/build-lint-test.yml +++ b/.github/workflows/build-lint-test.yml @@ -20,7 +20,6 @@ jobs: distribution: 'temurin' java-version: '11' cache: maven - gpg-passphrase: GPG_PASSPHRASE - name: Import GPG Key run: | From b8a2f23cb283a487a970605a7dcf1b14693d74df Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Fri, 4 Oct 2024 13:44:13 +0530 Subject: [PATCH 15/20] corrected the environment variable name for gpg passphrase --- .github/workflows/build-lint-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-lint-test.yml b/.github/workflows/build-lint-test.yml index 89fc65d6..74761542 100644 --- a/.github/workflows/build-lint-test.yml +++ b/.github/workflows/build-lint-test.yml @@ -32,5 +32,5 @@ jobs: export GPG_TTY=$(tty) mvn clean verify -DskipTests=true env: - GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} working-directory: Xero-Java From 9481ae05c8deb1bbcdece96abd4e2ea09e29314c Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Fri, 4 Oct 2024 15:28:12 +0530 Subject: [PATCH 16/20] fixed some other dependencies --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index f7e59959..cf0c3dca 100644 --- a/pom.xml +++ b/pom.xml @@ -173,7 +173,7 @@ org.apache.maven.plugins maven-source-plugin - 3.0.1 + 3.3.1 attach-sources @@ -203,7 +203,7 @@ org.apache.maven.plugins maven-pmd-plugin - 3.8 + 3.25.0 org.codehaus.mojo @@ -315,7 +315,7 @@ UTF-8 UTF-8 11 - 1.6.3 + 1.6.14 2.7.0 2.25.1 2.18.0 From 78bbe0a86f0f9a11da871855947b97122e81ee01 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Mon, 21 Oct 2024 15:12:37 +0530 Subject: [PATCH 17/20] ci: Added slack alert --- .github/actions/notify-slack/action.yml | 103 ++++++++++++++++++++++++ .github/workflows/publish.yml | 73 ++++++++++++++++- 2 files changed, 173 insertions(+), 3 deletions(-) create mode 100644 .github/actions/notify-slack/action.yml diff --git a/.github/actions/notify-slack/action.yml b/.github/actions/notify-slack/action.yml new file mode 100644 index 00000000..add9673f --- /dev/null +++ b/.github/actions/notify-slack/action.yml @@ -0,0 +1,103 @@ +name: slack-alert-action +description: "Action to send slack payload to public-sdk-events channel" + +inputs: + heading_text: + required: true + description: "Heading of the slack payload" + alert_type: + required: true + description: "type of the slack alert" + job_status: + required: true + description: "status of the job" + XERO_SLACK_WEBHOOK_URL: + required: true + description: "webhook url for channel - public-sdk-events" + job_url: + required: true + description: "job run id link" + button_type: + required: true + description: "color for the check logs button" + package_version: + required: true + description: "released package version" + repo_link: + required: true + description: "link of the repo" + + +runs: + using: "composite" + + steps: + + - name: Send slack notification + id: slack + uses: slackapi/slack-github-action@v1.27.0 + env: + SLACK_WEBHOOK_URL: ${{inputs.XERO_SLACK_WEBHOOK_URL}} + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK + with: + payload: | + { + "blocks": [ + { + "type": "rich_text", + "elements": [ + { + "type": "rich_text_section", + "elements": [ + { + "type": "text", + "text": "${{inputs.heading_text}} ", + "style": { + "bold": true + } + }, + { + "type": "emoji", + "name": "${{inputs.alert_type}}" + } + ] + } + ] + }, + { + "type": "divider" + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*Repository:* \n ${{inputs.repo_link}}" + }, + { + "type": "mrkdwn", + "text": "*Status:*\n ${{inputs.job_status}}" + }, + { + "type": "mrkdwn", + "text": "*Package Version:*\n ${{inputs.package_version}}" + } + ] + }, + { + "type": "actions", + "elements": [ + { + "type": "button", + "text": { + "type": "plain_text", + "text": "Check the logs", + "emoji": true + }, + "style": "${{inputs.button_type}}", + "url": "${{inputs.job_url}}" + } + ] + } + ] + } diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index abc3ab09..be8dd3cf 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -3,10 +3,20 @@ on: release: types: [published] + pull_request: + branches: + - master + jobs: publish: runs-on: ubuntu-latest + outputs: + release_number: ${{steps.get_latest_release_number.outputs.release_tag}} + permissions: + contents: write + pull-requests: write + steps: - name: Checkout Xero-Java repo uses: actions/checkout@v4 @@ -25,6 +35,16 @@ jobs: server-password: MAVEN_PASSWORD gpg-passphrase: GPG_PASSPHRASE + - name: Fetch Latest release number + id: get_latest_release_number + run: | + latest_version=$(gh release view --json tagName --jq '.tagName') + echo "Latest release version is - $latest_version" + echo "::set-output name=release_tag::$latest_version" + working-directory: Xero-Java + env: + GH_TOKEN: ${{secrets.GITHUB_TOKEN}} + - name: Import GPG Key run: | echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import @@ -36,7 +56,54 @@ jobs: export GPG_TTY=$(tty) mvn clean deploy -DskipTests=true env: - MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} - MAVEN_PASSWORD: ${{ secrets.MAVEN_TOKEN }} - GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + test: test + # MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + # MAVEN_PASSWORD: ${{ secrets.MAVEN_TOKEN }} + # GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} working-directory: Xero-Java + + notify-slack-on-success: + runs-on: ubuntu-latest + needs: publish + if: success() + steps: + - name: Checkout Xero-Java repo + uses: actions/checkout@v4 + with: + repository: XeroAPI/Xero-Java + path: Xero-Java + + - name: Send slack notification on success + uses: ./Xero-Java/.github/actions/notify-slack + with: + heading_text: "Publish job has succeeded !" + alert_type: "thumbsup" + job_status: "Success" + XERO_SLACK_WEBHOOK_URL: ${{secrets.XERO_SLACK_WEBHOOK_URL}} + job_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" + button_type: "primary" + package_version: ${{needs.publish.outputs.release_number}} + repo_link: ${{github.server_url}}/${{github.repository}} + + notify-slack-on-failure: + runs-on: ubuntu-latest + needs: publish + if: failure() + steps: + - name: Checkout Xero-Java repo + uses: actions/checkout@v4 + with: + repository: XeroAPI/Xero-Java + path: Xero-Java + + - name: Send slack notification on failure + uses: ./Xero-Java/.github/actions/notify-slack + with: + heading_text: "Publish job has failed !" + alert_type: "alert" + job_status: "Failed" + XERO_SLACK_WEBHOOK_URL: ${{secrets.XERO_SLACK_WEBHOOK_URL}} + job_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" + button_type: "danger" + package_version: ${{needs.publish.outputs.release_number}} + repo_link: ${{github.server_url}}/${{github.repository}} From d7187c14a19a2e5cce0a4c831221d7c54dfa49f8 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Mon, 21 Oct 2024 15:15:04 +0530 Subject: [PATCH 18/20] ci: clean up --- .github/workflows/publish.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index be8dd3cf..2f1cede9 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -3,10 +3,6 @@ on: release: types: [published] - pull_request: - branches: - - master - jobs: publish: runs-on: ubuntu-latest @@ -56,10 +52,9 @@ jobs: export GPG_TTY=$(tty) mvn clean deploy -DskipTests=true env: - test: test - # MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} - # MAVEN_PASSWORD: ${{ secrets.MAVEN_TOKEN }} - # GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_TOKEN }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} working-directory: Xero-Java notify-slack-on-success: From 4505f9398edc8a9a1130700e1db62e5544441eed Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Wed, 23 Oct 2024 13:16:08 +0530 Subject: [PATCH 19/20] ci: testing the successflow --- .github/workflows/publish.yml | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2f1cede9..99194293 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,6 +2,9 @@ name: Publish on: release: types: [published] + pull_request: + branches: + - master jobs: publish: @@ -41,21 +44,21 @@ jobs: env: GH_TOKEN: ${{secrets.GITHUB_TOKEN}} - - name: Import GPG Key - run: | - echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import - env: - GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY}} + # - name: Import GPG Key + # run: | + # echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import + # env: + # GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY}} - - name: Publish to Maven - run: | - export GPG_TTY=$(tty) - mvn clean deploy -DskipTests=true - env: - MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} - MAVEN_PASSWORD: ${{ secrets.MAVEN_TOKEN }} - GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} - working-directory: Xero-Java + # - name: Publish to Maven + # run: | + # export GPG_TTY=$(tty) + # mvn clean deploy -DskipTests=true + # env: + # MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + # MAVEN_PASSWORD: ${{ secrets.MAVEN_TOKEN }} + # GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + # working-directory: Xero-Java notify-slack-on-success: runs-on: ubuntu-latest From 3940e8092c7e9d5cde4ef3c868512635882eb7a7 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Wed, 23 Oct 2024 13:17:15 +0530 Subject: [PATCH 20/20] ci: reverted the testing changes --- .github/workflows/publish.yml | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 99194293..2f1cede9 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,9 +2,6 @@ name: Publish on: release: types: [published] - pull_request: - branches: - - master jobs: publish: @@ -44,21 +41,21 @@ jobs: env: GH_TOKEN: ${{secrets.GITHUB_TOKEN}} - # - name: Import GPG Key - # run: | - # echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import - # env: - # GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY}} + - name: Import GPG Key + run: | + echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import + env: + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY}} - # - name: Publish to Maven - # run: | - # export GPG_TTY=$(tty) - # mvn clean deploy -DskipTests=true - # env: - # MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} - # MAVEN_PASSWORD: ${{ secrets.MAVEN_TOKEN }} - # GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} - # working-directory: Xero-Java + - name: Publish to Maven + run: | + export GPG_TTY=$(tty) + mvn clean deploy -DskipTests=true + env: + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_TOKEN }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + working-directory: Xero-Java notify-slack-on-success: runs-on: ubuntu-latest