Skip to content

Commit 663fb4b

Browse files
authored
Refactor crosspost workflow for social media
Updated crosspost workflow to use a new action for posting to social media and removed Bluesky posting steps.
1 parent 01b61df commit 663fb4b

1 file changed

Lines changed: 20 additions & 26 deletions

File tree

.github/workflows/crosspost.yml

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: "Crosspost Release to Social Media"
22

33
on:
4+
release:
5+
types: [created]
46
workflow_dispatch:
57
inputs:
68
tag:
@@ -24,39 +26,30 @@ jobs:
2426
RELEASE_TAG: ${{ env.RELEASE_TAG }}
2527
run: gh release view "$RELEASE_TAG" --repo "${{ github.repository }}"
2628

27-
mastodon:
28-
name: "Post to Mastodon"
29+
crosspost:
30+
name: "Crosspost to Social Media"
2931
needs: validate
3032
runs-on: ubuntu-latest
3133
permissions:
3234
contents: read
3335
steps:
34-
- name: Post to Mastodon
35-
uses: cbrgm/mastodon-github-action@776364a15dd1171530479600c75363f7cbc89ef5 # v2.2.0
36+
- name: Crosspost to Bluesky and Mastodon
37+
uses: tgagor/action-crosspost@9523ff489bc74e1a9849c5d3071b6bcbad40042d # v1.6.3
3638
with:
37-
access-token: ${{ secrets.MASTODON_ACCESS_TOKEN }}
38-
url: https://mastodon.social
39+
feed-url: https://github.com/${{ github.repository }}/releases.atom
40+
limit: 1
41+
since: 15
42+
filter-urls: |
43+
/releases/tag/${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.event.release.tag_name }}
3944
message: |
40-
🎉 New release of ${{ github.event.repository.name }} ${{ env.RELEASE_TAG }} is out!
41-
https://github.com/${{ github.repository }}/releases/tag/${{ env.RELEASE_TAG }}
42-
#Java #JavaDecompiler #OpenSource #ReverseEngineering
43-
44-
bluesky:
45-
name: "Post to Bluesky"
46-
needs: validate
47-
runs-on: ubuntu-latest
48-
permissions:
49-
contents: read
50-
steps:
51-
- name: Post to Bluesky
52-
uses: cbrgm/bluesky-github-action@d643d172e122e8ced65f2bd5061b6e77c5146c07 # v1.2.5
53-
with:
54-
handle: ${{ secrets.BLUESKY_IDENTIFIER }}
55-
password: ${{ secrets.BLUESKY_PASSWORD }}
56-
text: |
57-
🎉 New release of ${{ github.event.repository.name }} ${{ env.RELEASE_TAG }} is out!
58-
https://github.com/${{ github.repository }}/releases/tag/${{ env.RELEASE_TAG }}
45+
🎉 New release of ${{ github.event.repository.name }} is out!
46+
{url}
5947
#Java #JavaDecompiler #OpenSource #ReverseEngineering
48+
bluesky-host: bsky.social
49+
bluesky-identifier: ${{ secrets.BLUESKY_IDENTIFIER }}
50+
bluesky-password: ${{ secrets.BLUESKY_PASSWORD }}
51+
mastodon-access-token: ${{ secrets.MASTODON_ACCESS_TOKEN }}
52+
mastodon-host: ${{ secrets.MASTODON_HOST }}
6053

6154
devto:
6255
name: "Publish to Dev.to"
@@ -72,6 +65,7 @@ jobs:
7265
REPOSITORY_NAME: ${{ github.event.repository.name }}
7366
REPOSITORY: ${{ github.repository }}
7467
run: |
68+
OPENGRAPH_CACHE_KEY="$(openssl rand -hex 32)"
7569
POST_FILE="posts/release-${RELEASE_TAG}.md"
7670
mkdir -p "$(dirname "$POST_FILE")"
7771
if [ ! -f "$POST_FILE" ]; then
@@ -83,7 +77,7 @@ jobs:
8377
tags: java, decompiler, opensource, reverseengineering
8478
---
8579
86-
[![${REPOSITORY_NAME} release ${RELEASE_TAG}](https://opengraph.githubassets.com/1/${REPOSITORY}/releases/tag/${RELEASE_TAG})](https://github.com/${REPOSITORY}/releases/tag/${RELEASE_TAG})
80+
[![${REPOSITORY_NAME} release ${RELEASE_TAG}](https://opengraph.githubassets.com/${OPENGRAPH_CACHE_KEY}/${REPOSITORY}/releases/tag/${RELEASE_TAG})](https://github.com/${REPOSITORY}/releases/tag/${RELEASE_TAG})
8781
EOF
8882
fi
8983
- name: Publish to Dev.to

0 commit comments

Comments
 (0)