lazily loading the matrix secrets
- fixes the nightly job failing due to missing secrets
This commit is contained in:
parent
cbad71b015
commit
2b26b55557
|
@ -6,8 +6,6 @@ import request from 'request'
|
||||||
import * as url from 'url'
|
import * as url from 'url'
|
||||||
matrixcs.request(request)
|
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 __dirname = url.fileURLToPath(new URL('.', import.meta.url));
|
||||||
|
|
||||||
const auth = new google.auth.GoogleAuth({
|
const auth = new google.auth.GoogleAuth({
|
||||||
|
@ -69,13 +67,8 @@ export const release = async (github, version, applicationId, artifacts, config)
|
||||||
console.log("Promoting beta draft release to live...")
|
console.log("Promoting beta draft release to live...")
|
||||||
await promoteDraftToLive(applicationId)
|
await promoteDraftToLive(applicationId)
|
||||||
|
|
||||||
const content = {
|
console.log("Sending message to room...")
|
||||||
"body": `New release`,
|
await sendReleaseMessage(releaseResult.data, config)
|
||||||
"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) => {
|
const startPlayRelease = async (applicationId) => {
|
||||||
|
@ -205,3 +198,15 @@ const promoteDraftToLive = async (applicationId) => {
|
||||||
packageName: applicationId,
|
packageName: applicationId,
|
||||||
}).catch((error) => Promise.reject(error.response.data))
|
}).catch((error) => Promise.reject(error.response.data))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const sendReleaseMessage = async (release, config) => {
|
||||||
|
const matrixAuth = JSON.parse(fs.readFileSync('.secrets/matrix.json'))
|
||||||
|
const client = matrix.createClient(matrixAuth)
|
||||||
|
const content = {
|
||||||
|
"body": `New release`,
|
||||||
|
"format": "org.matrix.custom.html",
|
||||||
|
"formatted_body": `New release rolling out <a href="${release.url}">${release.tag_name}</a>`,
|
||||||
|
"msgtype": "m.text"
|
||||||
|
}
|
||||||
|
await client.sendEvent(config.matrixRoomId, "m.room.message", content, "")
|
||||||
|
}
|
Loading…
Reference in New Issue