Merge pull request #107 from ouchadam/feature/release-syncing
Sync release to main
This commit is contained in:
commit
cbad71b015
|
@ -32,8 +32,10 @@ jobs:
|
||||||
mkdir .secrets
|
mkdir .secrets
|
||||||
touch .secrets/upload-key.jks
|
touch .secrets/upload-key.jks
|
||||||
touch .secrets/service-account.json
|
touch .secrets/service-account.json
|
||||||
|
touch .secrets/matrix.json
|
||||||
echo -n '${{ secrets.UPLOAD_KEY }}' | base64 --decode >> .secrets/upload-key.jks
|
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.SERVICE_ACCOUNT }}' | base64 --decode >> .secrets/service-account.json
|
||||||
|
echo -n '${{ secrets.MATRIX }}' | base64 --decode >> .secrets/matrix.json
|
||||||
|
|
||||||
- name: Assemble release variant
|
- name: Assemble release variant
|
||||||
run: ./tools/generate-release.sh ${{ secrets.STORE_PASS }}
|
run: ./tools/generate-release.sh ${{ secrets.STORE_PASS }}
|
||||||
|
|
|
@ -6,7 +6,8 @@ const config = {
|
||||||
pathToVersionFile: "version.json",
|
pathToVersionFile: "version.json",
|
||||||
rcBranchesFrom: "main",
|
rcBranchesFrom: "main",
|
||||||
rcMergesTo: "release",
|
rcMergesTo: "release",
|
||||||
packageName: "app.dapk.st"
|
packageName: "app.dapk.st",
|
||||||
|
matrixRoomId: "!jgNenzNPtSpJLjjsxe:matrix.org"
|
||||||
}
|
}
|
||||||
|
|
||||||
const rcBranchName = "release-candidate"
|
const rcBranchName = "release-candidate"
|
||||||
|
@ -22,14 +23,25 @@ export const startReleaseProcess = async ({ github, context, core }) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const publishRelease = async (github, artifacts) => {
|
export const publishRelease = async (github, artifacts) => {
|
||||||
const versionFile = await readVersionFile(github, "release")
|
const versionFile = await readVersionFile(github, config.rcMergesTo)
|
||||||
await release(
|
await release(
|
||||||
github,
|
github,
|
||||||
versionFile.content,
|
versionFile.content,
|
||||||
config.packageName,
|
config.packageName,
|
||||||
artifacts,
|
artifacts,
|
||||||
config,
|
config,
|
||||||
).catch((error) => console.log(error))
|
)
|
||||||
|
|
||||||
|
const createdPr = await github.rest.pulls.create({
|
||||||
|
owner: config.owner,
|
||||||
|
repo: config.repo,
|
||||||
|
title: "[Auto] Sync Release",
|
||||||
|
head: config.rcMergesTo,
|
||||||
|
base: config.rcBranchesFrom,
|
||||||
|
body: "Syncing changes from release",
|
||||||
|
})
|
||||||
|
|
||||||
|
await enablePrAutoMerge(createdPr.data.node_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
const isWorkingBranchAhead = async (github) => {
|
const isWorkingBranchAhead = async (github) => {
|
||||||
|
@ -77,7 +89,11 @@ const startRelease = async (github) => {
|
||||||
body: "todo",
|
body: "todo",
|
||||||
})
|
})
|
||||||
|
|
||||||
github.graphql(
|
await enablePrAutoMerge(createdPr.data.node_id)
|
||||||
|
}
|
||||||
|
|
||||||
|
const enablePrAutoMerge = async (prNodeId) => {
|
||||||
|
await github.graphql(
|
||||||
`
|
`
|
||||||
mutation ($pullRequestId: ID!, $mergeMethod: PullRequestMergeMethod!) {
|
mutation ($pullRequestId: ID!, $mergeMethod: PullRequestMergeMethod!) {
|
||||||
enablePullRequestAutoMerge(input: {
|
enablePullRequestAutoMerge(input: {
|
||||||
|
@ -96,7 +112,7 @@ const startRelease = async (github) => {
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
{
|
{
|
||||||
pullRequestId: createdPr.data.node_id,
|
pullRequestId: prNodeId,
|
||||||
mergeMethod: "MERGE"
|
mergeMethod: "MERGE"
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -6,6 +6,8 @@
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@googleapis/androidpublisher": "^3.0.0"
|
"@googleapis/androidpublisher": "^3.0.0",
|
||||||
|
"matrix-js-sdk": "^19.4.0",
|
||||||
|
"request": "^2.88.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
import * as google from '@googleapis/androidpublisher';
|
import * as google from '@googleapis/androidpublisher'
|
||||||
import * as fs from "fs";
|
import * as fs from "fs"
|
||||||
import * as http from 'https';
|
import * as http from 'https'
|
||||||
import * as url from 'url';
|
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 __dirname = url.fileURLToPath(new URL('.', import.meta.url));
|
||||||
|
|
||||||
const auth = new google.auth.GoogleAuth({
|
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...")
|
console.log("Promoting beta draft release to live...")
|
||||||
await promoteDraftToLive(applicationId)
|
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) => {
|
const startPlayRelease = async (applicationId) => {
|
||||||
|
@ -133,12 +146,6 @@ const dowloadSignedUniversalApk = async (version, applicationId, authToken, outp
|
||||||
})
|
})
|
||||||
|
|
||||||
const apks = apkRes.data.generatedApks
|
const apks = apkRes.data.generatedApks
|
||||||
|
|
||||||
console.log(`found ${apks.length} apks`)
|
|
||||||
apks.forEach((apk) => {
|
|
||||||
console.log(apk)
|
|
||||||
})
|
|
||||||
|
|
||||||
const id = apks[0].generatedUniversalApk.downloadId
|
const id = apks[0].generatedUniversalApk.downloadId
|
||||||
|
|
||||||
console.log(`downloading: ${id}`)
|
console.log(`downloading: ${id}`)
|
||||||
|
@ -198,4 +205,3 @@ const promoteDraftToLive = async (applicationId) => {
|
||||||
packageName: applicationId,
|
packageName: applicationId,
|
||||||
}).catch((error) => Promise.reject(error.response.data))
|
}).catch((error) => Promise.reject(error.response.data))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue