Add rpm server support #14
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: Continous Delivery to SUSE OBS | |
concurrency: cd-obs-${{ github.ref }} | |
on: | |
push: | |
tags-ignore: | |
- "*" | |
branches: | |
- "main" | |
pull_request: | |
release: | |
types: [published] | |
workflow_dispatch: | |
env: | |
OBS_USER: ${{ secrets.OBS_USER }} | |
OBS_PASS: ${{ secrets.OBS_PASSWORD }} | |
OBS_PROJECT: ${{ vars.OBS_PROJECT }} | |
jobs: | |
obs-commit: | |
runs-on: ubuntu-20.04 | |
if: github.ref == 'refs/heads/main' || github.event_name == 'release' | |
container: | |
image: ghcr.io/trento-project/continuous-delivery:main | |
env: | |
DEST_FOLDER: "/tmp/osc_project" | |
FOLDER: packaging/suse | |
PACKAGE: "trento-supportconfig-plugin" | |
options: -u 0:0 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions-ecosystem/action-get-latest-tag@v1 | |
id: latest-tag | |
with: | |
semver_only: true | |
initial_version: 0.0.1 | |
- name: Configure OSC | |
run: | | |
mkdir -p $HOME/.config/osc | |
cp /home/osc/.config/osc/oscrc $HOME/.config/osc | |
/scripts/init_osc_creds.sh | |
- name: Prepare _service file with version details | |
run: | | |
git config --global --add safe.directory /__w/support/support | |
VERSION=$(/scripts/get_version_from_git.sh) | |
PACKAGE_FOLDER=$FOLDER/$PACKAGE | |
sed -i 's~%%REVISION%%~${{ github.sha }}~' $PACKAGE_FOLDER/_service && \ | |
sed -i 's~%%VERSION%%~'"${VERSION}"'~' $PACKAGE_FOLDER/_service | |
- name: Prepare OBS package | |
run: | | |
PACKAGE_FOLDER=$FOLDER/$PACKAGE | |
osc checkout $OBS_PROJECT $PACKAGE -o $DEST_FOLDER | |
cp $PACKAGE_FOLDER/_service $DEST_FOLDER | |
cp $PACKAGE_FOLDER/${PACKAGE}.spec $DEST_FOLDER | |
rm $DEST_FOLDER/*.tar.gz | |
pushd $DEST_FOLDER | |
osc service manualrun | |
- name: Prepare .changes file | |
if: github.event_name == 'release' | |
run: | | |
CHANGES_FILE=${PACKAGE}.changes | |
TAG=${{ steps.latest-tag.outputs.tag }} | |
/scripts/gh_release_to_obs_changeset.py ${{ github.repository }} -a [email protected] -t $TAG -f $DEST_FOLDER/$CHANGES_FILE | |
- name: Commit on OBS | |
run: | | |
pushd $DEST_FOLDER | |
osc ar | |
osc commit -m "GitHub Actions automated update to reference ${{ github.sha }}" |