Skip to content

Fix CI

Fix CI #330

Workflow file for this run

name: build
on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: centos-stream-8
shortcut: cs8
container-name: el8stream
- name: centos-stream-9
shortcut: cs9
container-name: el9stream
name: ${{ matrix.name }}
env:
ARTIFACTS_DIR: exported-artifacts
container:
image: quay.io/ovirt/buildcontainer:${{ matrix.container-name }}
steps:
- name: Checkout sources
uses: ovirt/checkout-action@main
- name: Mark git repo as safe
run: git config --global --add safe.directory $(pwd)
- name: Use cache for maven
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Install additional build dependencies
run: |
dnf install -y ovirt-engine-api-metamodel unzip
- name: Perform build
run: |
.automation/build-rpm.sh $ARTIFACTS_DIR
- name: Upload artifacts
uses: ovirt/upload-rpms-action@main
with:
directory: ${{ env.ARTIFACTS_DIR }}
- name: Upload generated documentation artifacts
uses: actions/upload-artifact@v3
with:
name: generated-documentation-${{ matrix.shortcut }}
path: target/html/*
publish-doc:
permissions:
contents: write
needs: build
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
container:
image: quay.io/centos/centos:stream9
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Download generated documentation artifacts
uses: actions/download-artifact@v2
with:
name: generated-documentation-cs8
path: target
- name: Install package dependencies
run: |
dnf install \
git \
python3-devel \
python3-pip \
-y
- name: Set git defaults
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
- name: Checkout to gh-pages branch
uses: actions/checkout@v2
with:
ref: gh-pages
path: gh-pages
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set FOLDER variable according to push branch
run: |
IFS="/" read _ type value <<< ${GITHUB_REF}
if [[ ${type} == "heads" ]];
then
if [[ ${value} == "master" ]]
then
echo "FOLDER='master'" >> $GITHUB_ENV;
else
echo "FOLDER=${value: -3}" >> $GITHUB_ENV;
fi
elif [[ ${type} == "tags" ]]
then
echo "FOLDER=${value:0:3}" >> $GITHUB_ENV;
fi
- name: Move created documentation to gh-pages
run: |
mkdir -p ./gh-pages/${{env.FOLDER}}/
cp ./target/asciidoctor.css ./gh-pages/${{env.FOLDER}}/asciidoctor.css
cp ./target/model.html ./gh-pages/${{env.FOLDER}}/index.html
- name: Create index page
run: |
.automation/create-index-page.sh
- name: Push changes to gh-pages
run: |
cd gh-pages
commit=$(git log --format="%H" -n 1)
description=$(git describe --always)
if git status --porcelain 2>/dev/null| grep -E "^??|^M"
then
git add .
git commit -m "gh-pages ${description} ${commit}"
git push
fi
cd ..