Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix publish discord notification
Brendan Allan6a805fe52d8b
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.ymlindex b5d5486b2..6f7bcda6e 100644--- a/.github/workflows/publish.yml+++ b/.github/workflows/publish.yml@@ -105,7 +105,7 @@ jobs:script: |async function main() {const token = await core.getIDToken("cap-discord-bot");- const`cnReleaseId = JSON.parse("${{ steps.create_cn_release.outputs.stdout }}").id;+ const cnReleaseId = JSON.parse(`${{ needs.draft.outputs.cn_release_stdout }}`).id;const resp = await fetch("https://cap-discord-bot.brendonovich.workers.dev/github-workflow", {method: "POST",@@ -114,7 +114,8 @@ jobs:tag: "${{ steps.create_tag.outputs.tag_name }}",version: "${{ steps.read_version.outputs.value }}",releaseUrl: "${{ steps.create_gh_release.outputs.url }}",- interactionId: "${{ inputs.interactionId }}"+ interactionId: "${{ inputs.interactionId }}",+ cnReleaseId}),headers: {"Content-Type": "application/json",diff --git a/Cargo.lock b/Cargo.lockindex 07f8688c5..f1a98fb97 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -909,7 +909,7 @@ dependencies = [[[package]]name = "cap-desktop"-version = "0.3.23"+version = "0.3.24"dependencies = ["anyhow","axum",diff --git a/apps/desktop/src-tauri/Cargo.toml b/apps/desktop/src-tauri/Cargo.tomlindex 686999c35..2d2a49778 100644--- a/apps/desktop/src-tauri/Cargo.toml+++ b/apps/desktop/src-tauri/Cargo.toml@@ -1,6 +1,6 @@[package]name = "cap-desktop"-version = "0.3.23"+version = "0.3.24"description = "Beautiful screen recordings, owned by you."authors = ["you"]edition = "2021"diff --git a/apps/discord-bot/src/index.ts b/apps/discord-bot/src/index.tsindex edd06b8cf..f722617bf 100644--- a/apps/discord-bot/src/index.ts+++ b/apps/discord-bot/src/index.ts@@ -99,6 +99,7 @@ app.post(version: v.string(),interactionId: v.string(),releaseUrl: v.string(),+ cnReleaseId: v.string(),}),v.object({type: v.literal('release-done'),@@ -123,7 +124,7 @@ app.post(case 'release-ready': {await fetch(`https://discord.com/api/v10/webhooks/${DISCORD_APP_ID}/${interaction.token}/messages/@original`, {method: 'PATCH',- body: JSON.stringify(releaseWorkflowRunningMessageData(body.version, body.releaseUrl, c.get('githubToken').run_id)),+ body: JSON.stringify(releaseWorkflowRunningMessageData({ ...body, workflowRunId: c.get('githubToken').run_id })),headers: { 'Content-Type': 'application/json' },});@@ -133,13 +134,11 @@ app.post(await fetch(`https://discord.com/api/v10/channels/${interaction.channel_id}`, {method: 'POST',body: JSON.stringify(- releaseWorkflowDoneMessageData(- interaction.member.user.id,- body.version,- body.releaseUrl,- body.cnReleaseId,- c.get('githubToken').run_id- )+ releaseWorkflowDoneMessageData({+ ...body,+ userId: interaction.member.user.id,+ workflowRunId: c.get('githubToken').run_id,+ })),headers: { 'Content-Type': 'application/json' },});@@ -221,58 +220,54 @@ function releaseWorkflowStartedMessageData() {};}-function releaseWorkflowRunningMessageData(version: string, releaseUrl: string, workflowRunId: string) {+function releaseWorkflowRunningMessageData(props: { version: string } & Parameters<typeof releaseDraftedMessageComponents>[0]) {return {- content: `v${version} workflow running, go edit the release notes!`,+ content: `v${props.version} workflow running, go edit the release notes!`,components: [{type: 1,- components: [- {- type: 2,- label: 'Release Notes',- url: releaseUrl,- style: 5,- },- {- type: 2,- label: 'Workflow Run',- url: `https://github.com/${GITHUB_ORG}/${GITHUB_REPO}/actions/runs/${workflowRunId}`,- style: 5,- },- ],+ components: releaseDraftedMessageComponents(props),},],};}-function releaseWorkflowDoneMessageData(userId: string, version: string, releaseUrl: string, cnReleaseId: string, workflowRunId: string) {+function releaseWorkflowDoneMessageData(+ props: {+ userId: string;+ version: string;+ } & Parameters<typeof releaseDraftedMessageComponents>[0]+) {return {- content: [`<@${userId}> v${version} has finished building!`],+ content: [`<@${props.userId}> v${props.version} has finished building!`],components: [{type: 1,- components: [- {- type: 2,- label: 'Release Notes',- url: releaseUrl,- style: 5,- },- {- type: 2,- label: 'CN Cloud Release',- url: `https://web.crabnebula.cloud/org/cap/cap/releases/${cnReleaseId}`,- style: 5,- },- {- type: 2,- label: 'Workflow Run',- url: `https://github.com/${GITHUB_ORG}/${GITHUB_REPO}/actions/runs/${workflowRunId}`,- style: 5,- },- ],+ components: releaseDraftedMessageComponents(props),},],};}++function releaseDraftedMessageComponents(props: { releaseUrl: string; cnReleaseId: string; workflowRunId: string }) {+ return [+ {+ type: 2,+ label: 'Release Notes',+ url: props.releaseUrl,+ style: 5,+ },+ {+ type: 2,+ label: 'CN Cloud Release',+ url: `https://web.crabnebula.cloud/org/cap/cap/releases/${props.cnReleaseId}`,+ style: 5,+ },+ {+ type: 2,+ label: 'Workflow Run',+ url: `https://github.com/${GITHUB_ORG}/${GITHUB_REPO}/actions/runs/${props.workflowRunId}`,+ style: 5,+ },+ ];+}