diff --git a/tools/beta-release/release.js b/tools/beta-release/release.js index 5c7bb67..dfe83c7 100644 --- a/tools/beta-release/release.js +++ b/tools/beta-release/release.js @@ -6,8 +6,6 @@ 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({ @@ -69,13 +67,8 @@ 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 ${releaseResult.data.tag_name}`, - "msgtype": "m.text" - } - await client.sendEvent(config.matrixRoomId, "m.room.message", content, "") + console.log("Sending message to room...") + await sendReleaseMessage(releaseResult.data, config) } const startPlayRelease = async (applicationId) => { @@ -205,3 +198,15 @@ const promoteDraftToLive = async (applicationId) => { packageName: applicationId, }).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 ${release.tag_name}`, + "msgtype": "m.text" + } + await client.sendEvent(config.matrixRoomId, "m.room.message", content, "") +} \ No newline at end of file