Skip to content

Commit

Permalink
github actions workflow added for COPR and OBS
Browse files Browse the repository at this point in the history
  • Loading branch information
useidel committed May 30, 2024
1 parent fd422e0 commit 5712615
Showing 1 changed file with 81 additions and 0 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/rpmbuild_copr_obs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# This is workflow to build rpms using the SPEC file
# The Copr build service is used

name: rpmbuild_copr

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
# Looks there are no or not many native fedora-runners, hence we use a container
container: fedora:latest
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# That workspace (the directory) is different from the RPMBUILD space
- uses: actions/checkout@v3

# Install rpm and copr tools
- name: Install tooling for source RPM build
run: dnf -y install @development-tools @rpm-development-tools copr-cli make git

# Get/download the source files to the right place
- name: Get the sources for RPM package
run: ./getsources.sh

# Build the SRPM package
- name: Build the source RPM
run: rpmbuild -bs *.spec

# setup COPR Authentication
# You need to store your Copr authenication data under
# Settings -> Actions -> Repository secrets
- name: Install API token for copr-cli
env:
API_TOKEN_CONTENT: ${{ secrets.COPR_API_TOKEN }}
run: |
mkdir -p "$HOME/.config"
echo "$API_TOKEN_CONTENT" > "$HOME/.config/copr"
# Submit COPR build
# The path is not the $GITHUB_WORKSPACE it is the RPMBUILD space
- name: Submit the copr build
run: copr-cli build --nowait fetchmail7 /github/home/rpmbuild/SRPMS/*.src.rpm

#### And we take care of the OBS part

# Install osc tools
- name: Install tooling for openbuild service
run: dnf -y install osc wget

# setup OBS Authentication
# You need to store your OBS authenication data under
# Settings -> Actions -> Repository secrets
- name: Install API token for osb
env:
API_TOKEN_CONTENT: ${{ secrets.OBS_API_TOKEN }}
run: |
mkdir -p "$HOME/.config/osc"
echo "$API_TOKEN_CONTENT" > "$HOME/.config/osc/oscrc"
# prepare and trigger OBS package build
- name: prepare and trigger OBS package build
# we capture the commit message to use it for the obs submit
env:
MY_GITHUB_COMMIT_MSG: ${{ github.event.head_commit.message }}
run: ./submitobsbuild.sh

0 comments on commit 5712615

Please sign in to comment.