Skip to content

Commit

Permalink
show credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
juliocabrera820 committed May 2, 2024
1 parent 18c75ed commit 0f43ea3
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 0 deletions.
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
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

0 comments on commit 0f43ea3

Please sign in to comment.