Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/XeroAPI/Xero-Java into fi…
Browse files Browse the repository at this point in the history
…x/replace-byte-by-binary
  • Loading branch information
vigneshk-tw committed Oct 25, 2024
2 parents b209452 + 7883f7f commit af2dac3
Show file tree
Hide file tree
Showing 4 changed files with 231 additions and 23 deletions.
103 changes: 103 additions & 0 deletions .github/actions/notify-slack/action.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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}}"
}
]
}
]
}
4 changes: 3 additions & 1 deletion .github/workflows/build-lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,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:
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
working-directory: Xero-Java
104 changes: 104 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Publish
on:
release:
types: [published]

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
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
server-id: ossrh
server-username: MAVEN_USERNAME
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
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

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}}
43 changes: 21 additions & 22 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.19.4</version>
<version>4.4.0</version>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
Expand All @@ -68,17 +68,17 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.7</version>
<version>2.17.0</version>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.0.0</version>
<version>6.1.0</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.10.0</version>
<version>5.14.1</version>
<scope>test</scope>
</dependency>

Expand All @@ -92,7 +92,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.30</version>
<version>2.0.16</version>
</dependency>

<!-- JSON processing: jackson -->
Expand Down Expand Up @@ -159,7 +159,7 @@
<plugins>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<version>3.1.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -173,7 +173,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<version>3.3.1</version>
<executions>
<execution>
<id>attach-sources</id>
Expand Down Expand Up @@ -203,17 +203,17 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.8</version>
<version>3.25.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>3.0.4</version>
<version>3.0.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.1.0</version>
<version>3.4.0</version>
<configuration>
<webXml>example/src/main/webapp/WEB-INF/web.xml</webXml>
<webResources>
Expand All @@ -232,7 +232,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.2</version>
<version>3.10.1</version>
<configuration>
<source>8</source>
</configuration>
Expand All @@ -248,7 +248,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<version>3.2.7</version>
<executions>
<execution>
<id>sign-artifacts</id>
Expand All @@ -261,15 +261,14 @@
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
<passphraseServerId>gpg.passphrase</passphraseServerId>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<version>1.7.0</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
Expand All @@ -280,7 +279,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M4</version>
<version>3.5.0</version>
<configuration>
<argLine>-Duser.timezone=GMT-08:00</argLine>
</configuration>
Expand All @@ -292,12 +291,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.8</version>
<version>3.25.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>3.0.4</version>
<version>3.0.5</version>
<configuration>
<!-- Enables analysis which takes more memory but finds more bugs. If
you run out of memory, changes the value of the effort element to 'low'. -->
Expand All @@ -316,12 +315,12 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>11</java.version>
<swagger-annotations-version>1.6.3</swagger-annotations-version>
<google-api-client-version>2.3.0</google-api-client-version>
<swagger-annotations-version>1.6.14</swagger-annotations-version>
<google-api-client-version>2.7.0</google-api-client-version>
<jersey-common-version>2.25.1</jersey-common-version>
<jackson-version>2.16.1</jackson-version>
<jackson-databind-version>2.16.1</jackson-databind-version>
<jackson-threetenbp-version>2.12.5</jackson-threetenbp-version>
<jackson-version>2.18.0</jackson-version>
<jackson-databind-version>2.18.0</jackson-databind-version>
<jackson-threetenbp-version>2.15.2</jackson-threetenbp-version>
<junit-version>4.13.2</junit-version>
<org-apache-httpcomponents>4.5.3</org-apache-httpcomponents>
<jersey-version>3.1.5</jersey-version>
Expand Down

0 comments on commit af2dac3

Please sign in to comment.