-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1f42a5a
commit 4a8b746
Showing
3 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
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 @@ | ||
name: Discord | ||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
notify: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Notes 📝 | ||
id: notes | ||
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 | ||
with: | ||
result-encoding: string | ||
script: | | ||
notes = context.payload.release.body | ||
// replace all non-supported characters | ||
notes = notes.replaceAll('###', '') | ||
notes = notes.trim() | ||
return notes | ||
- name: Changelog 📝 | ||
uses: sebastianpopp/discord-action@4f2d5417bc61a79593304a62e71cd32427c17790 | ||
with: | ||
webhook: ${{ secrets.CHANGELOG_WEBHOOK }} | ||
message: | | ||
📦 ${{ github.event.release.name }} | ||
${{steps.notes.outputs.result}} | ||
${{ github.event.release.html_url }} |
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,26 @@ | ||
name: Social | ||
on: | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
bluesky: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install Node ⬇️ | ||
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 | ||
with: | ||
node-version: 18 | ||
- name: Checkout code 👋 | ||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 | ||
- name: Skyt 🌤️ | ||
working-directory: scripts/bluesky | ||
env: | ||
BLUESKY_IDENTIFIER: ${{ secrets.BLUESKY_IDENTIFIER }} | ||
BLUESKY_PASSWORD: ${{ secrets.BLUESKY_PASSWORD }} | ||
OWNER: JanDeDobbeleer | ||
REPO: oh-my-posh | ||
run: | | ||
npm install | ||
node main.js |
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,44 @@ | ||
const { BskyAgent } = require('@atproto/api'); | ||
const {Octokit} = require("@octokit/rest"); | ||
|
||
(async function main () { | ||
const github = new Octokit(); | ||
const response = await github.rest.repos.getLatestRelease({ | ||
owner: process.env.OWNER, | ||
repo: process.env.REPO, | ||
}); | ||
const release = response.data; | ||
|
||
let notes = release.body; | ||
|
||
// replace all non-supported characters | ||
notes = notes.replaceAll('### ', ''); | ||
notes = notes.replaceAll('**', ''); | ||
notes = notes.replace(/ \(\[[0-9a-z]+\]\(.*\)/g, ''); | ||
notes = notes.trim(); | ||
|
||
const agent = new BskyAgent({ service: 'https://bsky.social' }); | ||
await agent.login({ identifier: process.env.BLUESKY_IDENTIFIER, password: process.env.BLUESKY_PASSWORD }); | ||
|
||
const version = release.name; | ||
|
||
const text = `📦 ${version} | ||
${notes} | ||
#aliae #oss #cli #opensource`; | ||
|
||
console.log(`Posting to Bluesky:\n\n${text}`); | ||
|
||
await agent.post({ | ||
text: text, | ||
embed: { | ||
$type: 'app.bsky.embed.external', | ||
external: { | ||
uri: `https://github.com/JanDeDobbeleer/aliae/releases/tag/${version}`, | ||
title: "Something is sprouting 🌱", | ||
description: version, | ||
}, | ||
}, | ||
}); | ||
})(); |