Skip to content

add github work flow to build container and publish gem #1

add github work flow to build container and publish gem

add github work flow to build container and publish gem #1

Workflow file for this run

name: Build the ruby gem in a container

Check failure on line 1 in .github/workflows/build.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/build.yaml

Invalid workflow file

`pull-request` is not a valid event name
on:
pull-request:
release:
types:
- publish
jobs:
build-ruby-gem:
runs-on: debian-bookworm
steps:
- name: Checkout project code
uses: actions/checkout@v4
- name: Setup Docker builder
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and publish container on LinuxFr.org Github Organization
uses: docker/build-push-action@v5
with:
context: .
file: ./deployment/Containerfile
target: build
push: true
tags:
- ghcr.io/linuxfrorg/board-sse-linuxfr.org:latest
- ghcr.io/linuxfrorg/board-sse-linuxfr.org:${GITHUB_SHA}
cache-from: type=gha
cache-to: type=gha,mode=max
publish-ruby-gem:
if: ${{ github.event_name == 'release' }}
runs-on: ghcr.io/linuxfrorg/board-sse-linuxfr.org:${GITHUB_SHA}
steps:
- name: Publish gem to Github Package Repository
env:
GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
OWNER: ${{ github.repository_owner }}
run: |
set -euxo pipefail
IFS=$'\n\t'
mkdir -p "${HOME}/.gem"
touch "${HOME}/.gem/credentials"
chmod 0600 "${HOME}/.gem/credentials"
printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > "${HOME}/.gem/credentials"
gem push --KEY github --host "https://rubygems.pkg.github.com/${OWNER}" *.gem