-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1246 from WalletConnect/develop
BOM 1.20.0
- Loading branch information
Showing
71 changed files
with
1,165 additions
and
406 deletions.
There are no files selected for viewing
72 changes: 72 additions & 0 deletions
72
.github/workflows/scripts/slack_release_notifications_workflow.main.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/usr/bin/env kotlin | ||
@file:Suppress("PrivatePropertyName") | ||
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:1.4.0") | ||
|
||
import io.github.typesafegithub.workflows.actions.actions.CheckoutV4 | ||
import io.github.typesafegithub.workflows.domain.RunnerType.UbuntuLatest | ||
import io.github.typesafegithub.workflows.domain.actions.Action | ||
import io.github.typesafegithub.workflows.domain.actions.RegularAction | ||
import io.github.typesafegithub.workflows.domain.triggers.Release | ||
import io.github.typesafegithub.workflows.dsl.expressions.Contexts | ||
import io.github.typesafegithub.workflows.dsl.expressions.expr | ||
import io.github.typesafegithub.workflows.dsl.workflow | ||
import io.github.typesafegithub.workflows.yaml.writeToFile | ||
import org.intellij.lang.annotations.Language | ||
|
||
private val SLACK_WEBHOOK_URL_KOTLIN by Contexts.secrets | ||
|
||
workflow( | ||
name = "Slack Release Notifications", | ||
on = listOf( | ||
Release(_customArguments = mapOf("types" to listOf("published"))) | ||
), | ||
sourceFile = __FILE__.toPath(), | ||
) { | ||
job( | ||
id = "push-notifications", | ||
runsOn = UbuntuLatest, | ||
_customArguments = mapOf( | ||
"strategy" to mapOf( | ||
"matrix" to mapOf( | ||
"conf" to listOf( | ||
mapOf("webhook_url" to expr { SLACK_WEBHOOK_URL_KOTLIN }), | ||
) | ||
) | ||
) | ||
) | ||
) { | ||
uses( | ||
name = "Check out", | ||
action = CheckoutV4() | ||
) | ||
uses( | ||
name = "Notify Channel", | ||
action = SlackGithubAction(), | ||
env = linkedMapOf( | ||
"SLACK_WEBHOOK_URL" to expr { "matrix.conf.webhook_url" }, | ||
"SLACK_WEBHOOK_TYPE" to "INCOMING_WEBHOOK" | ||
) | ||
) | ||
} | ||
}.writeToFile(addConsistencyCheck = false) | ||
|
||
private class SlackGithubAction : RegularAction<Action.Outputs>( | ||
actionOwner = "slackapi", | ||
actionName = "slack-github-action", | ||
actionVersion = "v1.24.0" | ||
) { | ||
@Language("JSON") | ||
private val slackPayload = | ||
""" | ||
{ | ||
"text":"Kotlin Release ${expr { github.eventRelease.release.name }} was just released. Please update and let us know if you have any issues." | ||
} | ||
""".trimIndent() | ||
|
||
override fun buildOutputObject(stepId: String): Outputs = Outputs(stepId) | ||
|
||
override fun toYamlArguments(): LinkedHashMap<String, String> = | ||
linkedMapOf( | ||
"payload" to slackPayload | ||
) | ||
} |
31 changes: 31 additions & 0 deletions
31
.github/workflows/slack_release_notifications_workflow.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# This file was generated using Kotlin DSL (.github/workflows/scripts/slack_release_notifications_workflow.main.kts). | ||
# If you want to modify the workflow, please change the Kotlin file and regenerate this YAML file. | ||
# Generated with https://github.com/typesafegithub/github-workflows-kt | ||
|
||
name: 'Slack Release Notifications' | ||
on: | ||
release: | ||
types: | ||
- 'published' | ||
jobs: | ||
push-notifications: | ||
runs-on: 'ubuntu-latest' | ||
strategy: | ||
matrix: | ||
conf: | ||
- webhook_url: '${{ secrets.SLACK_WEBHOOK_URL_KOTLIN }}' | ||
steps: | ||
- id: 'step-0' | ||
name: 'Check out' | ||
uses: 'actions/checkout@v4' | ||
- id: 'step-1' | ||
name: 'Notify Channel' | ||
uses: 'slackapi/[email protected]' | ||
with: | ||
payload: |- | ||
{ | ||
"text":"Kotlin Release ${{ github.event.release.name }} was just released. Please update and let us know if you have any issues." | ||
} | ||
env: | ||
SLACK_WEBHOOK_URL: '${{ matrix.conf.webhook_url }}' | ||
SLACK_WEBHOOK_TYPE: 'INCOMING_WEBHOOK' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.