agama/.github/workflows/obs-service-shared.yml
Ladislav Slezák 94870bc0f0
[SLE-16.0] Cache installed Ruby gems in CI (#3528)
## Problems

- Old versions of GitHub Actions (they use old unsupported NodeJS v20,
GitHub prints a ["Node.js 20 actions are deprecated"
](https://github.com/agama-project/agama/actions/runs/26086960005)
warning)
- Installing the needed Ruby gems takes quite long time (about [one and
half
minute](https://github.com/agama-project/agama/actions/runs/26175301761/job/77003739150#step:9:7))

## Solution

- Update the GitHub Action versions
- Cache the installed Ruby gems, restoring the cache and running Bundler
now takes [just about 15
seconds](https://github.com/agama-project/agama/actions/runs/26182626931/job/77029525706#step:8:17).
So the test run is it at least more than one minute faster!

## Testing

- Tested with the updated GitHub Actions
2026-05-21 09:48:50 +02:00

75 lines
2.3 KiB
YAML

# this is a shared workflow, not called as a top level workflow
name: Update OBS Service Package
permissions:
contents: read
on:
workflow_call:
secrets:
OBS_PASSWORD:
required: true
jobs:
update_service:
# do not run in forks which do not set the OBS_PROJECTS and OBS_USER variables,
# or the mapping for the current branch is missing
if: vars.OBS_PROJECTS && fromJson(vars.OBS_PROJECTS)[github.ref_name] && vars.OBS_USER
runs-on: ubuntu-latest
container:
image: registry.opensuse.org/opensuse/tumbleweed:latest
env:
# to avoid Ruby UTF-8 errors (the default is "POSIX")
LC_ALL: en_US.UTF-8
steps:
- name: Configure and refresh repositories
# disable unused repositories to have a faster refresh
run: zypper modifyrepo -d repo-non-oss repo-openh264 repo-update && zypper ref
- name: Install tools
run: zypper --non-interactive install --no-recommends
bzip2
diffutils
git
obs-service-format_spec_file
osc
ruby
'rubygem(gem2rpm)'
'rubygem(yast-rake)'
- name: Git Checkout (full history)
if: ${{ github.ref_type != 'tag' }}
uses: actions/checkout@v6
with:
# fetch all history, we need to find the latest tag and offset for the version number
fetch-depth: 0
- name: Configure git
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Git Checkout
uses: actions/checkout@v6
with:
# fetch all history with tags, we need to find the latest version tag
fetch-depth: 0
fetch-tags: true
- name: Configure osc
run: .github/workflows/configure_osc.sh
env:
OBS_USER: ${{ vars.OBS_USER }}
OBS_PASSWORD: ${{ secrets.OBS_PASSWORD }}
- name: Commit the rubygem-agama-yast package to ${{ fromJson(vars.OBS_PROJECTS)[github.ref_name] }}
run: rake osc:commit
working-directory: ./service
env:
# do not build the package with "osc", it takes long time
# and does not provide much value
SKIP_OSC_BUILD: 1
OBS_PROJECT: ${{ fromJson(vars.OBS_PROJECTS)[github.ref_name] }}