pipeline: post_to_socials: image: alpine:3.18 environment: MASTODON_INSTANCE: from_secret: mastodon_instance MASTODON_TOKEN: from_secret: mastodon_token BLUESKY_HANDLE: from_secret: bluesky_handle BLUESKY_PASSWORD: from_secret: bluesky_password commands: - apk add --no-cache curl jq yq # Frontmatter extrahieren - sed -n '/^---$/,/^---$/p' content/post.md | sed '1d;$d' > frontmatter.yaml # Felder lesen - post_title=$(yq e '.title' frontmatter.yaml) - post_description=$(yq e '.description' frontmatter.yaml) - post_url=$(yq e '.id' frontmatter.yaml) # Keywords in Hashtags - post_keywords=$( yq e '.keywords[]' frontmatter.yaml \ | sed 's/^/#/' \ | paste -sd ' ' - ) # Nachricht zusammensetzen - message="${post_title}\n\n${post_description}\n\n${post_url}\n${post_keywords}" - echo "Nachricht:\n$message" # Mastodon - echo "Poste auf Mastodon..." - | curl -s -X POST \ -H "Authorization: Bearer $MASTODON_TOKEN" \ --data-urlencode "status=$message" \ "$MASTODON_INSTANCE/api/v1/statuses" # Bluesky - echo "Poste auf Bluesky..." - export BLUESKY_JWT=$( curl -s -X POST https://bsky.social/xrpc/com.atproto.server.createSession \ -H 'Content-Type: application/json' \ -d "{\"identifier\":\"$BLUESKY_HANDLE\",\"password\":\"$BLUESKY_PASSWORD\"}" \ | jq -r '.accessJwt' ) - | curl -s -X POST https://bsky.social/xrpc/com.atproto.repo.createRecord \ -H "Authorization: Bearer $BLUESKY_JWT" \ -H 'Content-Type: application/json' \ -d "{ \"collection\":\"app.bsky.feed.post\", \"repo\":\"$BLUESKY_HANDLE\", \"record\": { \"\$type\": \"app.bsky.feed.post\", \"text\": \"$message\" } }" branches: only: - main