From 744f3eb2186cfbaf2192ea2add3cf390338a122f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89douard=20Lopez?= Date: Thu, 23 Apr 2026 09:56:17 +0200 Subject: [PATCH 1/2] ci: attach images from release notes to social post --- .github/workflows/social-networks.yml | 53 ++++++++++++++++++--------- 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/.github/workflows/social-networks.yml b/.github/workflows/social-networks.yml index fec60585..6db77cb0 100644 --- a/.github/workflows/social-networks.yml +++ b/.github/workflows/social-networks.yml @@ -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: '' @@ -53,6 +53,21 @@ 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 values + PATHS=$(echo "$RELEASE_BODY" | grep -oP ']+src="\K[^"]+' | paste -sd',') + # Extract alt values + ALTS=$(echo "$RELEASE_BODY" | grep -oP ']+alt="\K[^"]+' | paste -sd',') + + echo "Extracted image paths: $PATHS" + echo "Extracted image alt texts: $ALTS" + echo "image-paths=$PATHS" >> "$GITHUB_OUTPUT" + echo "image-alt-texts=$ALTS" >> "$GITHUB_OUTPUT" + - name: Send post to Bluesky id: post2bluesky uses: cbrgm/bluesky-github-action@v1 # https://github.com/marketplace/actions/bluesky-send-post @@ -66,20 +81,24 @@ 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 - uses: cbrgm/mastodon-github-action@v2 # https://github.com/marketplace/actions/post-to-mastodon - env: - MASTODON_URL: "https://piaille.fr" # Mastodon instance URL, e.g., https://example.social. - MASTODON_TOKEN: ${{ secrets.PERSONAL_MASTODON_TOKEN_PIAILLE }} # Mastodon access token for authentication. - with: - access-token: ${{ env.MASTODON_TOKEN }} # Mastodon access token for authentication. - url: ${{ env.MASTODON_URL }} - message: | - 🐟 New Pure ${{ inputs.release_tag || github.event.release.tag_name }}! - See https://github.com/pure-fish/pure/releases/tag/${{ inputs.release_tag || github.event.release.tag_name }} + # - name: Post to Mastodon (Piaille.fr) + # id: post2paille + # uses: cbrgm/mastodon-github-action@v2 # https://github.com/marketplace/actions/post-to-mastodon + # env: + # MASTODON_URL: "https://piaille.fr" # Mastodon instance URL, e.g., https://example.social. + # MASTODON_TOKEN: ${{ secrets.PERSONAL_MASTODON_TOKEN_PIAILLE }} # Mastodon access token for authentication. + # with: + # access-token: ${{ env.MASTODON_TOKEN }} # Mastodon access token for authentication. + # url: ${{ env.MASTODON_URL }} + # message: | + # 🐟 New Pure ${{ inputs.release_tag || github.event.release.tag_name }}! + # See https://github.com/pure-fish/pure/releases/tag/${{ inputs.release_tag || github.event.release.tag_name }} - ${{ steps.prepare_body.outputs.truncated_body }} - #fish #shell #release - language: "en" + # ${{ 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 From e80f2374d89a8c9e5a3e846e437a4028718cbd5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89douard=20Lopez?= Date: Thu, 23 Apr 2026 15:26:40 +0200 Subject: [PATCH 2/2] ci: download image locally so we can attach them --- .github/workflows/social-networks.yml | 60 +++++++++++++++------------ 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/.github/workflows/social-networks.yml b/.github/workflows/social-networks.yml index 6db77cb0..506ea181 100644 --- a/.github/workflows/social-networks.yml +++ b/.github/workflows/social-networks.yml @@ -58,15 +58,23 @@ jobs: env: RELEASE_BODY: ${{ inputs.release_body || github.event.release.body }} run: | - # Extract src values - PATHS=$(echo "$RELEASE_BODY" | grep -oP ']+src="\K[^"]+' | paste -sd',') - # Extract alt values + # Extract src URLs and alt values + URLS=$(echo "$RELEASE_BODY" | grep -oP ']+src="\K[^"]+' | paste -sd',') ALTS=$(echo "$RELEASE_BODY" | grep -oP ']+alt="\K[^"]+' | paste -sd',') - echo "Extracted image paths: $PATHS" - echo "Extracted image alt texts: $ALTS" - echo "image-paths=$PATHS" >> "$GITHUB_OUTPUT" - echo "image-alt-texts=$ALTS" >> "$GITHUB_OUTPUT" + # 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 @@ -81,24 +89,24 @@ 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 + 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 - # uses: cbrgm/mastodon-github-action@v2 # https://github.com/marketplace/actions/post-to-mastodon - # env: - # MASTODON_URL: "https://piaille.fr" # Mastodon instance URL, e.g., https://example.social. - # MASTODON_TOKEN: ${{ secrets.PERSONAL_MASTODON_TOKEN_PIAILLE }} # Mastodon access token for authentication. - # with: - # access-token: ${{ env.MASTODON_TOKEN }} # Mastodon access token for authentication. - # url: ${{ env.MASTODON_URL }} - # message: | - # 🐟 New Pure ${{ inputs.release_tag || github.event.release.tag_name }}! - # See https://github.com/pure-fish/pure/releases/tag/${{ inputs.release_tag || github.event.release.tag_name }} + - name: Post to Mastodon (Piaille.fr) + id: post2paille + uses: cbrgm/mastodon-github-action@v2 # https://github.com/marketplace/actions/post-to-mastodon + env: + MASTODON_URL: "https://piaille.fr" # Mastodon instance URL, e.g., https://example.social. + MASTODON_TOKEN: ${{ secrets.PERSONAL_MASTODON_TOKEN_PIAILLE }} # Mastodon access token for authentication. + with: + access-token: ${{ env.MASTODON_TOKEN }} # Mastodon access token for authentication. + url: ${{ env.MASTODON_URL }} + message: | + 🐟 New Pure ${{ inputs.release_tag || github.event.release.tag_name }}! + See https://github.com/pure-fish/pure/releases/tag/${{ inputs.release_tag || github.event.release.tag_name }} - # ${{ 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 + ${{ 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