About the authentication see: https://developer.twitter.com/en/apps create an account, create an app @see https://apps.twitter.com/
@see https://developer.twitter.com/en/apps
workflow "on push tag, tweet message" {
on = "push"
resolves = ["Advertise tweetosphere with a message"]
}
action "Advertise tweetosphere with a message" {
uses = "xorilog/twitter-action@master"
args = ["-message", "New version is out ! $GITHUB_REF"]
secrets = ["TWITTER_CONSUMER_KEY", "TWITTER_CONSUMER_SECRET", "TWITTER_ACCESS_TOKEN", "TWITTER_ACCESS_SECRET"]
}
---
workflow "on push tag, tweet the content of a file" {
on = "push"
resolves = ["Advertise tweetosphere with the content of a file"]
}
action "Advertise tweetosphere with the content of a file" {
uses = "xorilog/twitter-action@master"
args = ["-file", "./my-tweet.yolo"]
secrets = ["TWITTER_CONSUMER_KEY", "TWITTER_CONSUMER_SECRET", "TWITTER_ACCESS_TOKEN", "TWITTER_ACCESS_SECRET"]
}
---
workflow "on push tag, tweet message and file content" {
on = "push"
resolves = ["Advertise tweetosphere with a message and the content of a file"]
}
action "Advertise tweetosphere with a message and the content of a file" {
uses = "xorilog/twitter-action@master"
args = ["-message", "Here is the big news: ", "-file", "./my-tweet.yolo"]
secrets = ["TWITTER_CONSUMER_KEY", "TWITTER_CONSUMER_SECRET", "TWITTER_ACCESS_TOKEN", "TWITTER_ACCESS_SECRET"]
}
go get .
go build
export TWITTER_CONSUMER_KEY=xxx
export TWITTER_CONSUMER_SECRET=xxx
export TWITTER_ACCESS_TOKEN=xxx
export TWITTER_ACCESS_SECRET=xxx
./twitter-action -message "Hello Twitter :)"
Read the content of the given file and send it as a tweet
export TWITTER_CONSUMER_KEY=xxx
export TWITTER_CONSUMER_SECRET=xxx
export TWITTER_ACCESS_TOKEN=xxx
export TWITTER_ACCESS_SECRET=xxx
./twitter-action -file ~/my-tweet.yolo
This will concatenate the message and the content of the file given (handle the split yourself if needed)
export TWITTER_CONSUMER_KEY=xxx
export TWITTER_CONSUMER_SECRET=xxx
export TWITTER_ACCESS_TOKEN=xxx
export TWITTER_ACCESS_SECRET=xxx
./twitter-action -message "Here is the big news: " -file ~/my-tweet.yolo
# If building locally
docker build -t xorilog/twitter-action .
# else:
docker run --rm -e TWITTER_CONSUMER_KEY=${TWITTER_CONSUMER_KEY} \
-e TWITTER_CONSUMER_SECRET=${TWITTER_CONSUMER_SECRET} \
-e TWITTER_ACCESS_TOKEN=${TWITTER_ACCESS_TOKEN} \
-e TWITTER_ACCESS_SECRET=${TWITTER_ACCESS_SECRET} \
xorilog/twitter-action -message "Hello Twitter :)"
./twitter-action -message "Here is the big news: " -file ~/my-tweet.yolo -dry"
2019/03/28 16:04:47 Logging in, creating client and updating status.
2019/03/28 16:04:47 Status updated with: Here is the big news: I am file my-tweet.yolo and this is my content.