v1.0.0-rc2 #2
Workflow file for this run
This file contains hidden or 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: | |
| RELEASE_NAME: ${{ github.ref_name }} | |
| BUILD_PATH: ${{ github.workspace }}/ruby | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - name: Install Ruby | |
| run: | | |
| sudo apt update | |
| sudo apt install -y ruby | |
| - name: Checkout code from repo | |
| uses: actions/checkout@v4 | |
| - name: Build the Ruby package | |
| run: | | |
| cd $BUILD_PATH | |
| export HLA_ALGORITHM_VERSION=$( echo $RELEASE_NAME | sed 's/^[vV]//' ) | |
| gem build ${BUILD_PATH}/hla_algorithm.gemspec | |
| - 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 $RELEASE_NAME ${BUILD_PATH}/*.gem |