Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

GitHub Actions workflow for publishing gem versions #50

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish Gem

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+"

jobs:
publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: ruby-3.1
bundler-cache: true
bundler: default
- name: Check for RubyGems credentials
run: |
if [ -z "${RUBYGEMS_API_KEY}" ]; then
echo "Missing RUBYGEMS_API_KEY!"
exit 2
fi
- name: Configure RubyGems access
run: |
mkdir -p ~/.gem
touch ~/.gem/credentials
chmod 600 ~/.gem/credentials
echo ":rubygems_api_key: ${RUBYGEMS_API_KEY}" >> ~/.gem/credentials
- name: Build Ruby gem
run: gem build duffel_api.gemspec
- name: Publish Ruby gem
run: find . -name 'duffel_api-*.gem' -maxdepth 1 -exec gem push {} \;