posting message to matrix room on release upload

This commit is contained in:
Adam Brown 2022-08-31 22:38:22 +01:00
parent ebfcd1f058
commit 9e17f77a75
5 changed files with 964 additions and 8 deletions

View File

@ -32,8 +32,10 @@ jobs:
mkdir .secrets
touch .secrets/upload-key.jks
touch .secrets/service-account.json
touch .secrets/matrix.json
echo -n '${{ secrets.UPLOAD_KEY }}' | base64 --decode >> .secrets/upload-key.jks
echo -n '${{ secrets.SERVICE_ACCOUNT }}' | base64 --decode >> .secrets/service-account.json
echo -n '${{ secrets.MATRIX }}' | base64 --decode >> .secrets/matrix.json
- name: Assemble release variant
run: ./tools/generate-release.sh ${{ secrets.STORE_PASS }}

View File

@ -6,7 +6,8 @@ const config = {
pathToVersionFile: "version.json",
rcBranchesFrom: "main",
rcMergesTo: "release",
packageName: "app.dapk.st"
packageName: "app.dapk.st",
matrixRoomId: "!jgNenzNPtSpJLjjsxe:matrix.org"
}
const rcBranchName = "release-candidate"

File diff suppressed because it is too large Load Diff

View File

@ -6,6 +6,8 @@
"type": "module",
"private": true,
"dependencies": {
"@googleapis/androidpublisher": "^3.0.0"
"@googleapis/androidpublisher": "^3.0.0",
"matrix-js-sdk": "^19.4.0",
"request": "^2.88.2"
}
}

View File

@ -1,8 +1,13 @@
import * as google from '@googleapis/androidpublisher';
import * as fs from "fs";
import * as http from 'https';
import * as url from 'url';
import * as google from '@googleapis/androidpublisher'
import * as fs from "fs"
import * as http from 'https'
import matrixcs, * as matrix from 'matrix-js-sdk'
import request from 'request'
import * as url from 'url'
matrixcs.request(request)
const matrixAuth = JSON.parse(fs.readFileSync('.secrets/matrix.json'))
const client = matrix.createClient(matrixAuth)
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
const auth = new google.auth.GoogleAuth({
@ -63,6 +68,14 @@ export const release = async (github, version, applicationId, artifacts, config)
console.log("Promoting beta draft release to live...")
await promoteDraftToLive(applicationId)
const content = {
"body": `New release`,
"format": "org.matrix.custom.html",
"formatted_body": `New release rolling out <a href="${releaseResult.data.url}">${releaseResult.data.tag_name}</a>`,
"msgtype": "m.text"
}
await client.sendEvent(config.matrixRoomId, "m.room.message", content, "")
}
const startPlayRelease = async (applicationId) => {
@ -192,4 +205,3 @@ const promoteDraftToLive = async (applicationId) => {
packageName: applicationId,
}).catch((error) => Promise.reject(error.response.data))
}