-
Notifications
You must be signed in to change notification settings - Fork 32
141 lines (120 loc) · 3.75 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
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 ..