0.4.0.pre #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: Add gem as a release asset | |
run: gh release upload $CFE_GOTOH_VERSION ${BUILD_PATH}/*.gem | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |