Skip to content

Commit

Permalink
Added a step to add the gem as an asset to the release; also streamli…
Browse files Browse the repository at this point in the history
…ned the environment variables.
  • Loading branch information
Richard Liang committed Nov 21, 2024
1 parent 3d4600c commit e75a1d8
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/build_and_publish_gem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ on:
jobs:
build_gem:
runs-on: ubuntu-latest

env:
CFE_GOTOH_VERSION: ${{ github.ref_name }}
BUILD_PATH: ${{ github.workspace }}/ruby
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Checkout code from repo
uses: actions/checkout@v4
Expand All @@ -25,15 +31,19 @@ jobs:
cacheFrom: ghcr.io/cfe-lab/gotoh_devcontainer
runCmd: cd /workspaces/gotoh/ruby && bash build_gem.bash
env: |
CFE_GOTOH_VERSION=${{ github.ref_name }}
CFE_GOTOH_VERSION
- name: Publish gem to Github Packages
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:github: Bearer ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
printf -- "---\n:github: Bearer ${GH_TOKEN}\n" > $HOME/.gem/credentials
gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} ${BUILD_PATH}/*.gem
env:
GEM_HOST_API_KEY: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}

- name: Add gem as a release asset
run: gh release upload $CFE_GOTOH_VERSION ${BUILD_PATH}/*.gem
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit e75a1d8

Please sign in to comment.