Skip to content

0.4.0.pre2

0.4.0.pre2 #2

name: Build and publish the Ruby package
on:
release:
types: [published]
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
- name: Log into GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build devcontainer and build the package
uses: devcontainers/[email protected]
with:
imageName: ghcr.io/cfe-lab/gotoh_devcontainer
cacheFrom: ghcr.io/cfe-lab/gotoh_devcontainer
runCmd: cd /workspaces/gotoh/ruby && bash build_gem.bash
env: |
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 ${GH_TOKEN}\n" > $HOME/.gem/credentials
gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} ${BUILD_PATH}/*.gem
env:
OWNER: ${{ github.repository_owner }}
- name: Publish gem to RubyGems
run: gem push ${BUILD_PATH}/*.gem
env:
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
- name: Add gem as a release asset
run: gh release upload $CFE_GOTOH_VERSION ${BUILD_PATH}/*.gem
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}