mirror of
https://github.com/ouchadam/small-talk.git
synced 2025-02-16 12:10:45 +01:00
Merge pull request #109 from ouchadam/release-candidate
[Auto] Release Candidate
This commit is contained in:
commit
4fc4bc8bbc
1
.github/workflows/nightly.yml
vendored
1
.github/workflows/nightly.yml
vendored
@ -1,6 +1,7 @@
|
||||
name: Nightly
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 19 * * *'
|
||||
|
||||
|
2
.github/workflows/release-candidate.yml
vendored
2
.github/workflows/release-candidate.yml
vendored
@ -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 }}
|
||||
|
@ -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"
|
||||
@ -22,14 +23,25 @@ export const startReleaseProcess = async ({ github, context, core }) => {
|
||||
}
|
||||
|
||||
export const publishRelease = async (github, artifacts) => {
|
||||
const versionFile = await readVersionFile(github, "release")
|
||||
const versionFile = await readVersionFile(github, config.rcMergesTo)
|
||||
await release(
|
||||
github,
|
||||
versionFile.content,
|
||||
config.packageName,
|
||||
artifacts,
|
||||
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(github, createdPr.data.node_id)
|
||||
}
|
||||
|
||||
const isWorkingBranchAhead = async (github) => {
|
||||
@ -77,7 +89,11 @@ const startRelease = async (github) => {
|
||||
body: "todo",
|
||||
})
|
||||
|
||||
github.graphql(
|
||||
await enablePrAutoMerge(github, createdPr.data.node_id)
|
||||
}
|
||||
|
||||
const enablePrAutoMerge = async (github, prNodeId) => {
|
||||
await github.graphql(
|
||||
`
|
||||
mutation ($pullRequestId: ID!, $mergeMethod: PullRequestMergeMethod!) {
|
||||
enablePullRequestAutoMerge(input: {
|
||||
@ -96,7 +112,7 @@ const startRelease = async (github) => {
|
||||
}
|
||||
`,
|
||||
{
|
||||
pullRequestId: createdPr.data.node_id,
|
||||
pullRequestId: prNodeId,
|
||||
mergeMethod: "MERGE"
|
||||
}
|
||||
)
|
||||
|
941
tools/beta-release/package-lock.json
generated
941
tools/beta-release/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -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"
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,10 @@
|
||||
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 __dirname = url.fileURLToPath(new URL('.', import.meta.url));
|
||||
|
||||
@ -63,6 +66,9 @@ export const release = async (github, version, applicationId, artifacts, config)
|
||||
|
||||
console.log("Promoting beta draft release to live...")
|
||||
await promoteDraftToLive(applicationId)
|
||||
|
||||
console.log("Sending message to room...")
|
||||
await sendReleaseMessage(releaseResult.data, config)
|
||||
}
|
||||
|
||||
const startPlayRelease = async (applicationId) => {
|
||||
@ -133,12 +139,6 @@ const dowloadSignedUniversalApk = async (version, applicationId, authToken, outp
|
||||
})
|
||||
|
||||
const apks = apkRes.data.generatedApks
|
||||
|
||||
console.log(`found ${apks.length} apks`)
|
||||
apks.forEach((apk) => {
|
||||
console.log(apk)
|
||||
})
|
||||
|
||||
const id = apks[0].generatedUniversalApk.downloadId
|
||||
|
||||
console.log(`downloading: ${id}`)
|
||||
@ -173,12 +173,12 @@ const downloadToFile = async (url, options, outputFile) => {
|
||||
})
|
||||
}
|
||||
|
||||
const promoteDraftToLive = async () => {
|
||||
const fappEditId = await startPlayRelease(applicationId)
|
||||
const promoteDraftToLive = async (applicationId) => {
|
||||
const editId = await startPlayRelease(applicationId)
|
||||
|
||||
await androidPublisher.edits.tracks
|
||||
.update({
|
||||
editId: fappEditId,
|
||||
editId: editId,
|
||||
packageName: applicationId,
|
||||
track: "beta",
|
||||
requestBody: {
|
||||
@ -194,8 +194,19 @@ const promoteDraftToLive = async () => {
|
||||
|
||||
|
||||
await androidPublisher.edits.commit({
|
||||
editId: fappEditId,
|
||||
editId: editId,
|
||||
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 <a href="${release.url}">${release.tag_name}</a>`,
|
||||
"msgtype": "m.text"
|
||||
}
|
||||
await client.sendEvent(config.matrixRoomId, "m.room.message", content, "")
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"name": "0.0.1-alpha04",
|
||||
"code": 7
|
||||
"code": 8
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user