Deploy RPM to OBS #12
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: CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
release: | |
types: [published] | |
jobs: | |
tlint: | |
name: Lint checks | |
runs-on: ubuntu-20.04 | |
container: | |
image: ghcr.io/trento-project/tlint:latest | |
volumes: | |
- ${{ github.workspace }}:/data | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Run TLint | |
run: "/home/tlint/tlint lint -f /data/checks" | |
obs-commit-rpm: | |
name: Commit to OBS to generate a RPM package | |
needs: [tlint] | |
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: | |
OBS_USER: ${{ secrets.OBS_USER }} | |
OBS_PASS: ${{ secrets.OBS_PASS }} | |
OBS_PROJECT: ${{ secrets.OBS_PROJECT }} | |
OSC_CHECKOUT_DIR: /tmp/trento-checks-package | |
REPOSITORY: ${{ github.repository }} | |
FOLDER: packaging/suse/rpm | |
options: -u 0:0 | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- 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 | |
run: | | |
git config --global --add safe.directory /__w/checks/checks | |
VERSION=$(./hack/get_version_from_git.sh) | |
sed -i 's~%%REVISION%%~${{ github.sha }}~' $FOLDER/_service && \ | |
sed -i 's~%%REPOSITORY%%~'"${REPOSITORY}"'~' $FOLDER/_service && \ | |
sed -i 's~%%VERSION%%~'"${VERSION}"'~' $FOLDER/_service | |
- name: Checkout and prepare OBS package | |
run: | | |
osc checkout $OBS_PROJECT trento-checks -o $OSC_CHECKOUT_DIR | |
cp $FOLDER/_service $OSC_CHECKOUT_DIR | |
cp $FOLDER/trento-checks.spec $OSC_CHECKOUT_DIR | |
rm -vf $OSC_CHECKOUT_DIR/*.tar.gz | |
pushd $OSC_CHECKOUT_DIR | |
osc service manualrun | |
rm -vf $OSC_CHECKOUT_DIR/*.tgz | |
- name: Prepare trento-checks.changes file | |
# The .changes file is updated only in release creation. This current task should be improved | |
# in order to add the current rolling release notes | |
if: github.event_name == 'release' | |
run: | | |
git config --global --add safe.directory /__w/checks/checks | |
VERSION=$(./hack/get_version_from_git.sh) | |
TAG=$(echo $VERSION | cut -f1 -d+) | |
hack/gh_release_to_obs_changeset.py $REPOSITORY -a [email protected] -t $TAG -f $OSC_CHECKOUT_DIR/trento-checks.changes | |
- name: Commit changes into OBS | |
run: | | |
pushd $OSC_CHECKOUT_DIR | |
osc ar | |
osc commit -m "GitHub Actions automated update to reference ${{ github.sha }}" |