social
Post release announcements to social media platforms from the command line.
Usage
relizy social [options]What It Does
The social command posts release announcements to configured social media platforms (Twitter, Slack):
- Loads release information from git tags or bump result
- Generates changelog summaries
- Formats messages for each platform
- Posts to enabled platforms (Twitter, Slack)
- Handles platform-specific requirements (character limits, formatting)
Prerequisites
Install the required peer dependencies for the platforms you want to use:
# For Twitter
pnpm add -D twitter-api-v2
# For Slack
pnpm add -D @slack/web-apiOptions
--from
Specify the starting git tag/commit reference for changelog generation:
relizy social --from v1.0.0--to
Specify the ending git tag/commit reference for changelog generation:
relizy social --to v1.1.0--config
Use a different configuration file:
relizy social --config relizy.productionThis will load relizy.production.config.ts instead of relizy.config.ts.
--dry-run
Test social media posting without actually posting:
relizy social --dry-run --from v1.0.0 --to v1.1.0This will:
- Load configuration
- Generate messages
- Log what would be posted
- NOT make actual API calls
--log-level
Control logging verbosity:
relizy social --log-level debugAvailable levels:
silent- No outputerror- Errors onlywarn- Warnings and errorslog- Standard logsinfo- Informational messages (default)debug- Detailed debugging informationverbose- Maximum verbosity
--no-safety-check
Skip safety checks (credentials validation, configuration warnings):
relizy social --no-safety-checkWARNING
Use with caution. Safety checks help catch configuration issues before posting.
Examples
Basic Usage
Post about the latest release:
relizy social --from v1.0.0 --to v1.1.0This will:
- Generate changelog from v1.0.0 to v1.1.0
- Post to all enabled platforms (Twitter, Slack)
Test Before Posting
Use dry-run to preview what will be posted:
relizy social --dry-run --from v1.0.0 --to v1.1.0Output:
[dry-run] Would post to Twitter:
🎉 MyProject v1.1.0 released!
✨ Features
- Add new feature X
- Improve performance
🐛 Fixes
- Fix bug Y
https://github.com/user/myproject/releases/tag/v1.1.0
[dry-run] Would post to Slack (#releases):
🚀 *MyProject v1.1.0* is now available!
...With Custom Log Level
See detailed logs:
relizy social --from v1.0.0 --to v1.1.0 --log-level debugUsing Different Config
Use production configuration:
relizy social --config relizy.production --from v1.0.0 --to v1.1.0Configuration
Configure social media platforms in relizy.config.ts:
import { defineConfig } from 'relizy'
export default defineConfig({
social: {
twitter: {
enabled: true,
onlyStable: true, // Skip prerelease versions
template: '🎉 {{projectName}} v{{version}} released!\n\n{{changelog}}\n\n{{releaseUrl}}',
credentials: {
apiKey: process.env.TWITTER_API_KEY,
apiKeySecret: process.env.TWITTER_API_KEY_SECRET,
accessToken: process.env.TWITTER_ACCESS_TOKEN,
accessTokenSecret: process.env.TWITTER_ACCESS_TOKEN_SECRET,
},
},
slack: {
enabled: true,
onlyStable: false, // Post all releases
channel: '#releases',
template: '🚀 *{{projectName}} v{{version}}*\n\n{{changelog}}\n\n<{{releaseUrl}}|View Release>',
credentials: {
token: process.env.SLACK_TOKEN,
},
},
changelogUrl: 'https://myproject.com/changelog',
},
})Environment Variables
Twitter
Set these environment variables for Twitter posting:
export TWITTER_API_KEY="your_api_key"
export TWITTER_API_KEY_SECRET="your_api_secret"
export TWITTER_ACCESS_TOKEN="your_access_token"
export TWITTER_ACCESS_TOKEN_SECRET="your_access_token_secret"Or with RELIZY_ prefix:
export RELIZY_TWITTER_API_KEY="your_api_key"
export RELIZY_TWITTER_API_KEY_SECRET="your_api_secret"
export RELIZY_TWITTER_ACCESS_TOKEN="your_access_token"
export RELIZY_TWITTER_ACCESS_TOKEN_SECRET="your_access_token_secret"Slack
Set this environment variable for Slack posting:
export SLACK_TOKEN="xoxb-your-bot-token"Or with RELIZY_ prefix:
export RELIZY_SLACK_TOKEN="xoxb-your-bot-token"Using .env File
Create a .env file in your project root:
# Twitter
TWITTER_API_KEY=your_api_key
TWITTER_API_KEY_SECRET=your_api_key_secret
TWITTER_ACCESS_TOKEN=your_access_token
TWITTER_ACCESS_TOKEN_SECRET=your_access_token_secret
# Slack
SLACK_TOKEN=xoxb-your-bot-tokenRelizy will automatically load these variables.
CI/CD Integration
GitHub Actions
name: Social Media Announcements
on:
release:
types: [published]
jobs:
announce:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Post to social media
env:
TWITTER_API_KEY: ${{ secrets.TWITTER_API_KEY }}
TWITTER_API_KEY_SECRET: ${{ secrets.TWITTER_API_KEY_SECRET }}
TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
run: |
# Get the latest two tags
LATEST_TAG=$(git describe --tags --abbrev=0)
PREVIOUS_TAG=$(git describe --tags --abbrev=0 $LATEST_TAG^)
# Post to social media
pnpm relizy social --from $PREVIOUS_TAG --to $LATEST_TAGGitLab CI
social:
stage: announce
only:
- tags
script:
- pnpm install
- |
LATEST_TAG=$(git describe --tags --abbrev=0)
PREVIOUS_TAG=$(git describe --tags --abbrev=0 $LATEST_TAG^)
pnpm relizy social --from $PREVIOUS_TAG --to $LATEST_TAG
variables:
TWITTER_API_KEY: $TWITTER_API_KEY
TWITTER_API_KEY_SECRET: $TWITTER_API_KEY_SECRET
TWITTER_ACCESS_TOKEN: $TWITTER_ACCESS_TOKEN
TWITTER_ACCESS_TOKEN_SECRET: $TWITTER_ACCESS_TOKEN_SECRET
SLACK_TOKEN: $SLACK_TOKENTroubleshooting
Missing Credentials
Error:
Twitter is enabled but credentials are missing.
Set the following environment variables...Solution: Set the required environment variables or configure credentials in your config file.
Missing Peer Dependency
Error:
Missing dependency: twitter-api-v2
Please install it: pnpm add -D twitter-api-v2Solution: Install the required peer dependency:
pnpm add -D twitter-api-v2Slack Channel Not Found
Error:
Slack API error: channel_not_foundSolution:
- Verify the channel name/ID is correct
- Ensure your Slack bot has been invited to the channel
- For public channels, add the
chat:write.publicscope
Twitter Character Limit
Error:
Tweet exceeds 280 charactersSolution: Relizy automatically truncates tweets, but you can customize the template to make it shorter:
template: '🎉 {{projectName}} v{{version}}\n{{releaseUrl}}'Integration with release Command
The social command is automatically run as part of the release workflow when enabled:
import { defineConfig } from 'relizy'
export default defineConfig({
release: {
social: true, // Enable social posting in release workflow
},
social: {
twitter: { enabled: true },
slack: { enabled: true, channel: '#releases' },
},
})Then:
relizy release --patchThis will run the complete workflow including social media posting.
Monorepo Behavior
Independent Mode
In independent mode, separate posts are created for each package:
relizy social --from v1.0.0 --to v1.1.0If package-a and package-b were both released, you'll get:
- One tweet for package-a
- One tweet for package-b
- One Slack message for package-a
- One Slack message for package-b
Unified/Selective Mode
In unified or selective mode, a single post is created for all packages:
relizy social --from v1.0.0 --to v1.1.0You'll get:
- One tweet for the release
- One Slack message for the release
See Also
- release - Full release workflow (includes social posting)
- Configuration reference - Social media configuration
- API reference - Programmatic usage
- Twitter Integration Guide - Twitter setup
- Slack Integration Guide - Slack setup
- Social Media Overview - General overview