Skip to content

Commit fcda9ae

Browse files
Merge branch 'master' into feature/prism-changes-java
2 parents 6760165 + f53bb5f commit fcda9ae

File tree

26 files changed

+354
-35
lines changed

26 files changed

+354
-35
lines changed
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: slack-alert-action
2+
description: "Action to send slack payload to public-sdk-events channel"
3+
4+
inputs:
5+
heading_text:
6+
required: true
7+
description: "Heading of the slack payload"
8+
alert_type:
9+
required: true
10+
description: "type of the slack alert"
11+
job_status:
12+
required: true
13+
description: "status of the job"
14+
XERO_SLACK_WEBHOOK_URL:
15+
required: true
16+
description: "webhook url for channel - public-sdk-events"
17+
job_url:
18+
required: true
19+
description: "job run id link"
20+
button_type:
21+
required: true
22+
description: "color for the check logs button"
23+
package_version:
24+
required: true
25+
description: "released package version"
26+
repo_link:
27+
required: true
28+
description: "link of the repo"
29+
30+
31+
runs:
32+
using: "composite"
33+
34+
steps:
35+
36+
- name: Send slack notification
37+
id: slack
38+
uses: slackapi/[email protected]
39+
env:
40+
SLACK_WEBHOOK_URL: ${{inputs.XERO_SLACK_WEBHOOK_URL}}
41+
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
42+
with:
43+
payload: |
44+
{
45+
"blocks": [
46+
{
47+
"type": "rich_text",
48+
"elements": [
49+
{
50+
"type": "rich_text_section",
51+
"elements": [
52+
{
53+
"type": "text",
54+
"text": "${{inputs.heading_text}} ",
55+
"style": {
56+
"bold": true
57+
}
58+
},
59+
{
60+
"type": "emoji",
61+
"name": "${{inputs.alert_type}}"
62+
}
63+
]
64+
}
65+
]
66+
},
67+
{
68+
"type": "divider"
69+
},
70+
{
71+
"type": "section",
72+
"fields": [
73+
{
74+
"type": "mrkdwn",
75+
"text": "*Repository:* \n ${{inputs.repo_link}}"
76+
},
77+
{
78+
"type": "mrkdwn",
79+
"text": "*Status:*\n ${{inputs.job_status}}"
80+
},
81+
{
82+
"type": "mrkdwn",
83+
"text": "*Package Version:*\n ${{inputs.package_version}}"
84+
}
85+
]
86+
},
87+
{
88+
"type": "actions",
89+
"elements": [
90+
{
91+
"type": "button",
92+
"text": {
93+
"type": "plain_text",
94+
"text": "Check the logs",
95+
"emoji": true
96+
},
97+
"style": "${{inputs.button_type}}",
98+
"url": "${{inputs.job_url}}"
99+
}
100+
]
101+
}
102+
]
103+
}

.github/octokit/index.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import {Octokit} from "@octokit/rest";
2+
import {createAppAuth} from "@octokit/auth-app"
3+
4+
export const getAccessToken = async () => {
5+
6+
const {GITHUB_APP_ID, GITHUB_APP_PRIVATE_KEY} = process.env
7+
8+
const octoKitInstance = new Octokit({
9+
authStrategy: createAppAuth,
10+
auth: {
11+
appId: GITHUB_APP_ID,
12+
privateKey: GITHUB_APP_PRIVATE_KEY
13+
}
14+
});
15+
16+
const {data: installations} = await octoKitInstance.rest.apps.listInstallations()
17+
18+
console.log("installations -----", installations);
19+
20+
21+
if(!installations.length) {
22+
throw new Error("No Installations found for this github app")
23+
}
24+
25+
const installationId = installations[0].id;
26+
27+
const installationAccessToken = await octoKitInstance.rest.apps.createInstallationAccessToken({installation_id: installationId})
28+
29+
return installationAccessToken.data.token
30+
}

.github/octokit/package.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "xero-octokit",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"type": "module",
7+
"scripts": {
8+
"test": "echo \"Error: no test specified\" && exit 1"
9+
},
10+
"author": "",
11+
"license": "ISC",
12+
"dependencies": {
13+
"@octokit/auth-app": "^7.1.1",
14+
"@octokit/rest": "^21.0.2"
15+
}
16+
}

.github/workflows/publish.yml

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
name: Publish & Release SDK
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
cab_id:
6+
description: "CAB id for the change/release"
7+
required: true
8+
type: string
9+
10+
jobs:
11+
publish:
12+
runs-on: ubuntu-latest
13+
environment: prod
14+
15+
outputs:
16+
release_number: ${{steps.get_latest_release_number.outputs.release_tag}}
17+
permissions:
18+
contents: write
19+
pull-requests: write
20+
21+
steps:
22+
- name: Checkout Xero-Java repo
23+
uses: actions/checkout@v4
24+
with:
25+
repository: XeroAPI/Xero-Java
26+
path: Xero-Java
27+
28+
- name: Set up JDK environment
29+
uses: actions/setup-java@v4
30+
with:
31+
distribution: 'temurin'
32+
java-version: '11'
33+
cache: maven
34+
server-id: ossrh
35+
server-username: MAVEN_USERNAME
36+
server-password: MAVEN_PASSWORD
37+
gpg-passphrase: GPG_PASSPHRASE
38+
39+
- name: Fetch Latest release number
40+
id: get_latest_release_number
41+
run: |
42+
latest_version=$(gh release view --json tagName --jq '.tagName')
43+
echo "Latest release version is - $latest_version"
44+
echo "::set-output name=release_tag::$latest_version"
45+
working-directory: Xero-Java
46+
env:
47+
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
48+
49+
- name: Import GPG Key
50+
run: |
51+
echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import
52+
env:
53+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY}}
54+
55+
- name: Publish to Maven
56+
run: |
57+
export GPG_TTY=$(tty)
58+
mvn clean deploy -DskipTests=true
59+
env:
60+
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
61+
MAVEN_PASSWORD: ${{ secrets.MAVEN_TOKEN }}
62+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
63+
working-directory: Xero-Java
64+
65+
notify-slack-on-success:
66+
runs-on: ubuntu-latest
67+
needs: publish
68+
if: success()
69+
permissions:
70+
contents: read
71+
steps:
72+
- name: Checkout Xero-Java repo
73+
uses: actions/checkout@v4
74+
with:
75+
repository: XeroAPI/Xero-Java
76+
path: Xero-Java
77+
78+
- name: Send slack notification on success
79+
uses: ./Xero-Java/.github/actions/notify-slack
80+
with:
81+
heading_text: "Publish job has succeeded !"
82+
alert_type: "thumbsup"
83+
job_status: "Success"
84+
XERO_SLACK_WEBHOOK_URL: ${{secrets.XERO_SLACK_WEBHOOK_URL}}
85+
job_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}"
86+
button_type: "primary"
87+
package_version: ${{needs.publish.outputs.release_number}}
88+
repo_link: ${{github.server_url}}/${{github.repository}}
89+
90+
notify-slack-on-failure:
91+
runs-on: ubuntu-latest
92+
needs: publish
93+
if: failure()
94+
permissions:
95+
contents: read
96+
steps:
97+
- name: Checkout Xero-Java repo
98+
uses: actions/checkout@v4
99+
with:
100+
repository: XeroAPI/Xero-Java
101+
path: Xero-Java
102+
103+
- name: Send slack notification on failure
104+
uses: ./Xero-Java/.github/actions/notify-slack
105+
with:
106+
heading_text: "Publish job has failed !"
107+
alert_type: "alert"
108+
job_status: "Failed"
109+
XERO_SLACK_WEBHOOK_URL: ${{secrets.XERO_SLACK_WEBHOOK_URL}}
110+
job_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}"
111+
button_type: "danger"
112+
package_version: ${{needs.publish.outputs.release_number}}
113+
repo_link: ${{github.server_url}}/${{github.repository}}
114+
115+
notify-codegen-repo:
116+
needs: publish
117+
if: always()
118+
runs-on: ubuntu-latest
119+
permissions:
120+
contents: write
121+
pull-requests: write
122+
123+
steps:
124+
- name: Checkout
125+
uses: actions/checkout@v4
126+
with:
127+
repository: XeroAPI/Xero-Java
128+
path: Xero-Java
129+
130+
- name: Install octokit dependencies
131+
run: npm i
132+
working-directory: Xero-Java/.github/octokit
133+
134+
- name: Get github app access token
135+
id: get_access_token
136+
env:
137+
GITHUB_APP_ID: ${{ secrets.XERO_CODEGEN_BOT_APPLICATION_ID }}
138+
GITHUB_APP_PRIVATE_KEY: ${{ secrets.XERO_CODEGEN_BOT_APPLICATION_KEY }}
139+
uses: actions/github-script@v7
140+
with:
141+
result-encoding: string
142+
script: |
143+
const { getAccessToken } = await import('${{ github.workspace }}/Xero-Java/.github/octokit/index.js')
144+
const token = await getAccessToken()
145+
return token
146+
147+
- name: Notify codegen repo
148+
run: |
149+
curl -X POST -H "Authorization: token ${{ steps.get_access_token.outputs.result }}" \
150+
-H "Accept: application/vnd.github.v3+json" \
151+
-H "Content-Type: application/json" \
152+
https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/notify-sdk-publish.yml/dispatches \
153+
-d '{
154+
"ref": "master",
155+
"inputs": {
156+
"commit": "${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}",
157+
"status": "${{needs.publish.result}}",
158+
"deployer": "xero-codegen-bot",
159+
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
160+
"environment": "prod",
161+
"sdk_type": "java",
162+
"cab_key": "${{ github.event.inputs.cab_id }}"
163+
}
164+
}'

docs/v4/accounting/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6335,7 +6335,7 @@
63356335
<nav id="scrollingNav">
63366336
<ul class="sidenav nav nav-list">
63376337
<li class="nav-header" data-group="Accounting"><strong>SDK: </strong><span id='sdk-name'></span></li>
6338-
<li class="nav-header" data-group="Accounting"><strong>VSN: </strong>10.1.0</li>
6338+
<li class="nav-header" data-group="Accounting"><strong>VSN: </strong>10.2.0</li>
63396339
<li class="nav-header" data-group="Accounting"><a href="#api-Accounting">Methods</a></li>
63406340
<li data-group="Accounting" data-name="createAccount" class="">
63416341
<a href="#api-Accounting-createAccount">createAccount</a>

docs/v4/appstore/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1237,7 +1237,7 @@
12371237
<nav id="scrollingNav">
12381238
<ul class="sidenav nav nav-list">
12391239
<li class="nav-header" data-group="AppStore"><strong>SDK: </strong><span id='sdk-name'></span></li>
1240-
<li class="nav-header" data-group="AppStore"><strong>VSN: </strong>10.1.0</li>
1240+
<li class="nav-header" data-group="AppStore"><strong>VSN: </strong>10.2.0</li>
12411241
<li class="nav-header" data-group="AppStore"><a href="#api-AppStore">Methods</a></li>
12421242
<li data-group="AppStore" data-name="getSubscription" class="">
12431243
<a href="#api-AppStore-getSubscription">getSubscription</a>

docs/v4/assets/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1386,7 +1386,7 @@
13861386
<nav id="scrollingNav">
13871387
<ul class="sidenav nav nav-list">
13881388
<li class="nav-header" data-group="Asset"><strong>SDK: </strong><span id='sdk-name'></span></li>
1389-
<li class="nav-header" data-group="Asset"><strong>VSN: </strong>10.1.0</li>
1389+
<li class="nav-header" data-group="Asset"><strong>VSN: </strong>10.2.0</li>
13901390
<li class="nav-header" data-group="Asset"><a href="#api-Asset">Methods</a></li>
13911391
<li data-group="Asset" data-name="createAsset" class="">
13921392
<a href="#api-Asset-createAsset">createAsset</a>

docs/v4/files/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1144,7 +1144,7 @@
11441144
<nav id="scrollingNav">
11451145
<ul class="sidenav nav nav-list">
11461146
<li class="nav-header" data-group="Files"><strong>SDK: </strong><span id='sdk-name'></span></li>
1147-
<li class="nav-header" data-group="Files"><strong>VSN: </strong>10.1.0</li>
1147+
<li class="nav-header" data-group="Files"><strong>VSN: </strong>10.2.0</li>
11481148
<li class="nav-header" data-group="Files"><a href="#api-Files">Methods</a></li>
11491149
<li data-group="Files" data-name="createFileAssociation" class="">
11501150
<a href="#api-Files-createFileAssociation">createFileAssociation</a>

docs/v4/finance/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2712,7 +2712,7 @@
27122712
<nav id="scrollingNav">
27132713
<ul class="sidenav nav nav-list">
27142714
<li class="nav-header" data-group="Finance"><strong>SDK: </strong><span id='sdk-name'></span></li>
2715-
<li class="nav-header" data-group="Finance"><strong>VSN: </strong>10.1.0</li>
2715+
<li class="nav-header" data-group="Finance"><strong>VSN: </strong>10.2.0</li>
27162716
<li class="nav-header" data-group="Finance"><a href="#api-Finance">Methods</a></li>
27172717
<li data-group="Finance" data-name="getAccountingActivityAccountUsage" class="">
27182718
<a href="#api-Finance-getAccountingActivityAccountUsage">getAccountingActivityAccountUsage</a>

docs/v4/payroll-au/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3411,7 +3411,7 @@
34113411
<nav id="scrollingNav">
34123412
<ul class="sidenav nav nav-list">
34133413
<li class="nav-header" data-group="PayrollAu"><strong>SDK: </strong><span id='sdk-name'></span></li>
3414-
<li class="nav-header" data-group="PayrollAu"><strong>VSN: </strong>10.1.0</li>
3414+
<li class="nav-header" data-group="PayrollAu"><strong>VSN: </strong>10.2.0</li>
34153415
<li class="nav-header" data-group="PayrollAu"><a href="#api-PayrollAu">Methods</a></li>
34163416
<li data-group="PayrollAu" data-name="approveLeaveApplication" class="">
34173417
<a href="#api-PayrollAu-approveLeaveApplication">approveLeaveApplication</a>

0 commit comments

Comments
 (0)