Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ft/credentials #1

Merged
merged 2 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
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
25 changes: 25 additions & 0 deletions .github/workflows/example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Test github action

on: [pull_request]

jobs:
test:
runs-on: ubuntu-latest
name: Ruby ${{ matrix.ruby }}
strategy:
matrix:
ruby:
- "3.0.6"
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Test action in local workflow
id: test-action
uses: ./
with:
github_token: xxxxx
rubygems_api_key: xxxxx
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0.6
26 changes: 26 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Build and publish gem
description: Publish gem in github packages and rubygems
author: juliocabrera820
branding:
icon: box
color: black
inputs:
github_token:
description: GitHub packages token
required: false
rubygems_api_key:
description: Rubygems API key
required: false
github_username:
description: Repository owner
required: false
default: ${{ github.repository_owner }}
runs:
using: composite
steps:
- run: ruby -W0 $GITHUB_ACTION_PATH/publish.rb
shell: sh
env:
RUBYGEMS_API_KEY: ${{inputs.rubygems_api_key}}
GITHUB_TOKEN: ${{inputs.github_token}}
GITHUB_USERNAME: ${{inputs.github_username}}
14 changes: 14 additions & 0 deletions credentials.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true

# Module to handle credentials
module Credentials
RUBYGEMS_API_KEY = ENV['RUBYGEMS_API_KEY']
GITHUB_TOKEN = ENV['GITHUB_TOKEN']
GITHUB_USERNAME = ENV['GITHUB_USERNAME']

def self.print_credentials
puts "RUBYGEMS_API_KEY: #{RUBYGEMS_API_KEY}"
puts "GITHUB_TOKEN: #{GITHUB_TOKEN}"
puts "GITHUB_USERNAME: #{GITHUB_USERNAME}"
end
end
5 changes: 5 additions & 0 deletions publish.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

require_relative 'credentials'

Credentials.print_credentials
Loading