Build the ruby gem in a container and publish it on Github Package Repository #7
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 the ruby gem in a container and publish it on Github Package Repository | |
on: | |
release: | |
types: | |
- published | |
jobs: | |
release-ruby-gem: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout project code | |
uses: actions/checkout@v4 | |
- name: Setup Docker builder | |
uses: docker/setup-buildx-action@v3 | |
- name: Build container for build target | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./deployment/Containerfile | |
target: build | |
push: false | |
load: true | |
tags: linuxfrorg/board-sse-linuxfr.org:${{ github.sha }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Publish gem to Github Package Repository | |
uses: addnab/docker-run-action@v3 | |
env: | |
GEM_HOST_API_KEY: "${{secrets.RUBYGEM_PUSH_KEY}}" | |
OWNER: ${{ github.repository_owner }} | |
with: | |
image: linuxfrorg/board-sse-linuxfr.org:${{ github.sha }} | |
options: >- | |
-e OWNER | |
-e GEM_HOST_API_KEY | |
run: | | |
set -eux | |
IFS=$'\n\t' | |
mkdir -p "${HOME}/.local/share/gem" | |
touch "${HOME}/.local/share/gem/credentials" | |
chmod 0600 "${HOME}/.local/share/gem/credentials" | |
printf -- "---\n:rubygem: ${GEM_HOST_API_KEY}\n" > "${HOME}/.local/share/gem/credentials" | |
gem push --KEY rubygem *.gem |