Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions .github/workflows/social-networks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ on:
workflow_dispatch:
inputs:
release_body:
description: 'The body of the release notes (leave empty to use latest release)'
description: 'The body of the release notes'
required: false
type: string
default: ''
release_tag:
description: 'The tag of the release (leave empty to use latest release tag)'
description: 'The tag of the release'
required: false
type: string
default: ''
Expand All @@ -53,6 +53,29 @@ jobs:
echo "$TRUNCATED_BODY" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

- name: Grab image from release body
id: grab_image
env:
RELEASE_BODY: ${{ inputs.release_body || github.event.release.body }}
run: |
# Extract src URLs and alt values
URLS=$(echo "$RELEASE_BODY" | grep -oP '<img[^>]+src="\K[^"]+' | paste -sd',')
ALTS=$(echo "$RELEASE_BODY" | grep -oP '<img[^>]+alt="\K[^"]+' | paste -sd',')

# Download images into workspace using relative paths (Docker actions mount GITHUB_WORKSPACE, not /tmp)
mkdir -p ".release-images"
LOCAL_PATHS=""
IFS=',' read -ra URL_LIST <<< "$URLS"
for url in "${URL_LIST[@]}"; do
filename="${url##*/}.png"
curl -sSL "$url" -o ".release-images/$filename"
LOCAL_PATHS="${LOCAL_PATHS:+$LOCAL_PATHS,}.release-images/$filename"
ls -lah ".release-images/$filename"
done

echo "image_paths=$LOCAL_PATHS" | tee -a "$GITHUB_OUTPUT"
echo "image_alt_texts=$ALTS" | tee -a "$GITHUB_OUTPUT"

- name: Send post to Bluesky
id: post2bluesky
uses: cbrgm/bluesky-github-action@v1 # https://github.com/marketplace/actions/bluesky-send-post
Expand All @@ -66,6 +89,8 @@ jobs:
${{ steps.prepare_body.outputs.truncated_body }}
#fish #shell #release
lang: "en"
image-paths: ${{ steps.grab_image.outputs.image_paths }} # Comma-separated list of image paths to include in the post
image-alt-texts: ${{ steps.grab_image.outputs.image_alt_texts }} # Comma-separated list of image alt texts

- name: Post to Mastodon (Piaille.fr)
id: post2paille
Expand All @@ -83,3 +108,5 @@ jobs:
${{ steps.prepare_body.outputs.truncated_body }}
#fish #shell #release
language: "en"
image-paths: ${{ steps.grab_image.outputs.image_paths }} # Comma-separated list of image paths to include in the post
image-alt-texts: ${{ steps.grab_image.outputs.image_alt_texts }} # Comma-separated list of image alt texts
Loading