mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-24 02:46:43 +00:00
Add Discourse release action
This commit is contained in:
parent
24ef80f4b6
commit
8e02266d07
2 changed files with 47 additions and 0 deletions
9
.github/workflows/release_actions.yml
vendored
9
.github/workflows/release_actions.yml
vendored
|
@ -21,6 +21,15 @@ jobs:
|
|||
|
||||
${{ github.event.release.body }}
|
||||
```
|
||||
discourse_release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install Node
|
||||
uses: actions/setup-node@v2
|
||||
if: ${{ ! github.event.release.prerelease }}
|
||||
with:
|
||||
node-version: '16'
|
||||
- run: script/discourse_release ${{ secrets.DISCOURSE_RELEASES_API_KEY }} ${{ github.event.release.tag_name }} ${{ github.event.release.body }}
|
||||
mixpanel_release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
|
38
script/discourse_release
Executable file
38
script/discourse_release
Executable file
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/env node --redirect-warnings=/dev/null
|
||||
|
||||
main();
|
||||
|
||||
async function main() {
|
||||
const apiKey = process.argv[2]
|
||||
const zedVersion = process.argv[3]
|
||||
const releaseNotes = process.argv[4]
|
||||
const postBody = `
|
||||
📣 Zed ${zedVersion} was just released!
|
||||
|
||||
Restart your Zed or head to the [releases page](https://zed.dev/releases/latest) to grab it.
|
||||
|
||||
---
|
||||
|
||||
${releaseNotes}
|
||||
`
|
||||
|
||||
const title = `${zedVersion} Release Notes`
|
||||
|
||||
const options = {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Api-Key": apiKey,
|
||||
"Api-Username": "system"
|
||||
},
|
||||
body: new URLSearchParams({
|
||||
title: title,
|
||||
raw: postBody,
|
||||
category: "8"
|
||||
})
|
||||
};
|
||||
|
||||
fetch("https://forum.zed.dev/posts.json", options)
|
||||
.then(response => response.json())
|
||||
.then(response => console.log(response))
|
||||
.catch(err => console.error(err));
|
||||
}
|
Loading…
Reference in a new issue