Skip to content

Commit 3ce276a

Browse files
nbauma109nbauma109claudeCopilot
authored
Migrate crosspost workflow to per-platform actions (#346)
* Migrate crosspost workflow to per-platform actions Replace tgagor/action-crosspost with dedicated actions for each platform: cbrgm/mastodon-github-action, cbrgm/bluesky-github-action, sinedied/publish-devto, and higgins/action-hackernews-post (Show HN). Each platform runs as an independent job so failures are isolated. Dev.to publishes a release article from a generated markdown file. HackerNews requires new HN_USERNAME and HN_PASSWORD secrets. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Fix HackerNews inputs and Mastodon URL scheme Pass HN credentials and post fields via with: instead of env: as required by higgins/action-hackernews-post action inputs. Prefix MASTODON_HOST with https:// since cbrgm/mastodon-github-action expects a full URL and the secret stores a bare hostname. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Address PR review: SHA pinning, checkout v6, dev.to safety - Pin all four third-party actions to immutable commit SHAs - Align actions/checkout to repository-standard v6 - Scope dev.to files glob to the current release only - Pass tag/repo values via env: to avoid shell interpolation risks - Guard post creation with [ ! -f ] to preserve dev.to article IDs on reruns, preventing duplicate article creation Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Add release validation, HN docs, safe post path creation - Add validate job that runs gh release view before any platform job, blocking all four crossposts on a mistyped workflow_dispatch tag - Replace fixed mkdir -p posts with mkdir -p on the file's parent dir so tags containing path separators don't silently fail - Document HN_USERNAME and HN_PASSWORD in distribution-submission.md alongside the other social crosspost secrets Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Update action versions in crosspost workflow * Fix Hacker News naming, shell injection, and account guidance - Rename job and doc heading to canonical "Hacker News" (two words) - Pass RELEASE_TAG via env: in the validate step so shell injection via a crafted tag cannot reach the runner before gh release view - Update HN docs to require a dedicated posting-only account and warn against using a maintainer's primary account (no app-password support) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Gate Hacker News crosspost to workflow dispatch only Agent-Logs-Url: https://github.com/nbauma109/jd-gui-duo/sessions/477b213b-4bb6-44ec-9285-4b3c94d47db9 Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.com> * Run crosspost workflow only on workflow dispatch Agent-Logs-Url: https://github.com/nbauma109/jd-gui-duo/sessions/509f3a92-80ea-47d1-b856-435cc46df9f9 Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.com> --------- Co-authored-by: nbauma109 <nbauma109@github.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.com>
1 parent 2db97d8 commit 3ce276a

2 files changed

Lines changed: 107 additions & 18 deletions

File tree

.github/workflows/crosspost.yml

Lines changed: 96 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,114 @@
11
name: "Crosspost Release to Social Media"
22

33
on:
4-
release:
5-
types: [created]
64
workflow_dispatch:
75
inputs:
86
tag:
97
description: Release tag to crosspost (for dispatches from release workflow)
108
required: true
119
type: string
1210

11+
env:
12+
RELEASE_TAG: ${{ github.event.inputs.tag }}
13+
1314
jobs:
14-
crosspost:
15-
name: "Crosspost to Social Media"
15+
validate:
16+
name: "Validate release exists"
1617
runs-on: ubuntu-latest
1718
permissions:
1819
contents: read
1920
steps:
20-
- name: Crosspost to Bluesky, Mastodon, and Dev.to
21-
uses: tgagor/action-crosspost@9523ff489bc74e1a9849c5d3071b6bcbad40042d # v1.6.3
21+
- name: Verify release tag
22+
env:
23+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
RELEASE_TAG: ${{ env.RELEASE_TAG }}
25+
run: gh release view "$RELEASE_TAG" --repo "${{ github.repository }}"
26+
27+
mastodon:
28+
name: "Post to Mastodon"
29+
needs: validate
30+
runs-on: ubuntu-latest
31+
permissions:
32+
contents: read
33+
steps:
34+
- name: Post to Mastodon
35+
uses: cbrgm/mastodon-github-action@776364a15dd1171530479600c75363f7cbc89ef5 # v2.2.0
2236
with:
23-
feed-url: https://github.com/${{ github.repository }}/releases.atom
24-
limit: 1
25-
filter-urls: |
26-
/releases/tag/${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.event.release.tag_name }}
37+
access-token: ${{ secrets.MASTODON_ACCESS_TOKEN }}
38+
url: https://${{ secrets.MASTODON_HOST }}
2739
message: |
28-
🎉 New release of ${{ github.event.repository.name }} is out!
29-
{url}
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 }}
3059
#Java #JavaDecompiler #OpenSource #ReverseEngineering
31-
bluesky-host: bsky.social
32-
bluesky-identifier: ${{ secrets.BLUESKY_IDENTIFIER }}
33-
bluesky-password: ${{ secrets.BLUESKY_PASSWORD }}
34-
mastodon-access-token: ${{ secrets.MASTODON_ACCESS_TOKEN }}
35-
mastodon-host: ${{ secrets.MASTODON_HOST }}
36-
devto-api-key: ${{ secrets.DEVTO_API_KEY }}
60+
61+
devto:
62+
name: "Publish to Dev.to"
63+
needs: validate
64+
runs-on: ubuntu-latest
65+
permissions:
66+
contents: write
67+
steps:
68+
- uses: actions/checkout@v6
69+
- name: Create release post
70+
env:
71+
RELEASE_TAG: ${{ env.RELEASE_TAG }}
72+
REPOSITORY_NAME: ${{ github.event.repository.name }}
73+
REPOSITORY: ${{ github.repository }}
74+
run: |
75+
POST_FILE="posts/release-${RELEASE_TAG}.md"
76+
mkdir -p "$(dirname "$POST_FILE")"
77+
if [ ! -f "$POST_FILE" ]; then
78+
cat > "$POST_FILE" << EOF
79+
---
80+
title: "${REPOSITORY_NAME} ${RELEASE_TAG} Released"
81+
published: true
82+
description: "New release of ${REPOSITORY_NAME}"
83+
tags: java, decompiler, opensource, reverseengineering
84+
---
85+
86+
🎉 New release of [${REPOSITORY_NAME}](https://github.com/${REPOSITORY}) is out!
87+
88+
Check out the [release notes](https://github.com/${REPOSITORY}/releases/tag/${RELEASE_TAG}).
89+
EOF
90+
fi
91+
- name: Publish to Dev.to
92+
uses: sinedied/publish-devto@c713cc0934b35cb3df9fca759b98e36e6a540a85 # v2
93+
with:
94+
devto_key: ${{ secrets.DEVTO_API_KEY }}
95+
github_token: ${{ secrets.GITHUB_TOKEN }}
96+
files: 'posts/release-${{ env.RELEASE_TAG }}.md'
97+
branch: master
98+
conventional_commits: false
99+
100+
hackernews:
101+
name: "Post to Hacker News"
102+
needs: validate
103+
if: ${{ github.event_name == 'workflow_dispatch' }}
104+
runs-on: ubuntu-latest
105+
permissions:
106+
contents: read
107+
steps:
108+
- name: Post Show HN
109+
uses: higgins/action-hackernews-post@74acdeb91fd56c6e46a448351515932c0b2ce049 # v1.0.1
110+
with:
111+
HN_USERNAME: ${{ secrets.HN_USERNAME }}
112+
HN_PASSWORD: ${{ secrets.HN_PASSWORD }}
113+
POST_TITLE: "Show HN: ${{ github.event.repository.name }} ${{ env.RELEASE_TAG }}"
114+
POST_URL: "https://github.com/${{ github.repository }}/releases/tag/${{ env.RELEASE_TAG }}"

docs/distribution-submission.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,17 @@ API posting cost:
106106
- https://developers.forem.com/
107107
- https://developers.forem.com/api/v0
108108

109+
### Hacker News
110+
111+
- `HN_USERNAME` — the username for a dedicated posting-only Hacker News account used by this workflow
112+
- `HN_PASSWORD` — the password for that dedicated posting-only Hacker News account
113+
114+
Each release is submitted as a **Show HN** post with the release URL. Hacker News has no API key or scoped app-password system, so the action authenticates with full account credentials directly. Do not use a maintainer's primary personal Hacker News account; create a separate posting-only account and store only that account's credentials in `HN_USERNAME` and `HN_PASSWORD`.
115+
116+
API posting cost:
117+
118+
- Free (`$0`). Hacker News has no paid API or posting tier.
119+
109120
### GitHub token for downstream workflow dispatch
110121

111122
- `PAT_TOKEN`

0 commit comments

Comments
 (0)