-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Andrew Nordman
committed
Jan 15, 2019
0 parents
commit 76f2c53
Showing
3 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM ruby:2.6.0 | ||
|
||
ENV LC_ALL C.UTF-8 | ||
ENV LANG en_US.UTF-8 | ||
ENV LANGUAGE en_US.UTF-8 | ||
|
||
ADD entrypoint.sh /entrypoint.sh | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# GitHub Action - Publish Gem to Rubygems | ||
|
||
This is a GitHub Action written to streamline the Ruby gem publication process. The action sets the Gem Credentials from `GITHUB_TOKEN` and `RUBYGEMS_API_KEY`secrets, and then runs `rake release` in your project root. You can override this command by setting `RELEASE_COMMAND` environment variable to the script that creates and publishes (this is usually only the case when a repository hosts multiple gems together). | ||
|
||
# Secrets Needed | ||
|
||
`GITHUB_TOKEN` - Bundler needs this to create tags on your repo for the release | ||
`RUBYGEMS_API_KEY` - The Rubygems API Key for an Owner of the Gem you wish to publish. You can find your API Key by looking in `~/.gem/credentials` or using the [Rubygems API](https://guides.rubygems.org/rubygems-org-api/#misc-methods) | ||
|
||
# Env Options | ||
|
||
`RELEASE_COMMAND` - By default, this will invoke `rake release` to build and publish the gem to Rubygems. Set this environment variable if you have a custom release command to be invoked | ||
|
||
# Example | ||
|
||
```hcl | ||
workflow "Publish Gem" { | ||
on = "release" | ||
resolves = ["Release Gem"] | ||
} | ||
action "Install Dependencies" { | ||
uses = "docker://ruby:2.6.0" | ||
args = "bundle install" | ||
} | ||
action "Release Gem" { | ||
uses = "cadwallion/publish-rubygems-action@master" | ||
secrets = ["GITHUB_TOKEN", "RUBYGEMS_API_KEY"] | ||
env = { | ||
"RELEASE_COMMAND" = "rake dotenv:release" | ||
} | ||
needs = ["Install Dependencies"] | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
echo "Setting up gem credentials..." | ||
set +x | ||
mkdir -p ~/.gem | ||
cat << EOF > ~/.gem/credentials | ||
--- | ||
:github: Bearer ${GITHUB_TOKEN} | ||
:rubygems_api_key: ${RUBYGEMS_API_KEY} | ||
EOF | ||
set -x | ||
|
||
echo "Running gem release task..." | ||
release_command="${RELEASE_COMMAND:-rake release}" | ||
exec $release_command |