Created
March 10, 2025 06:21
-
-
Save thiagochirana/7c326f7d3d81a0ab0c8c7533d6a2dbaa to your computer and use it in GitHub Desktop.
Simple CI/CI to RubyGems.org
This file contains hidden or 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
name: Ruby Gem CI CD | |
on: | |
push: | |
branches: ["main"] | |
jobs: | |
publish: | |
name: Publish and Build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: "3.1" | |
- name: Debug | |
run: | | |
echo "Token API Key is empty? ${{ secrets.RUBYGEMS_AUTH_TOKEN == '' }}" | |
echo "Credentials is not empty? $(test -f $HOME/.gem/credentials && echo 'Yes!' || echo 'No!')" | |
- name: Publish to RubyGems | |
env: | |
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_AUTH_TOKEN }} | |
run: | | |
mkdir -p $HOME/.gem | |
touch $HOME/.gem/credentials | |
chmod 0600 $HOME/.gem/credentials | |
echo "---" > $HOME/.gem/credentials | |
echo ":rubygems_api_key: ${RUBYGEMS_API_KEY}" >> $HOME/.gem/credentials | |
gem build *.gemspec | |
gem push *.gem |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment