Skip to content

Commit fa66177

Browse files
committed
Build documentation with Github Actions
Also ensures that static analysis and documentation generation will occur only on the main branch of the upstream repository. Signed-off-by: Stephen Gallagher <[email protected]>
1 parent e1bc0a4 commit fa66177

File tree

3 files changed

+36
-27
lines changed

3 files changed

+36
-27
lines changed

.ci/ci-docs.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ source $SCRIPT_DIR/ci-common.inc
88
set -e
99
set -x
1010

11+
modulemd_version=${1:-latest}
1112
os=fedora
1213
release=32
1314
repository=quay.io
@@ -22,8 +23,8 @@ mmd_run_docker_tests \
2223
test_template="docs/Dockerfile.tmpl" \
2324
test_image="libmodulemd-docs-$os:$release" \
2425
oci_extra_args="
25-
-e GITHUB_SHA=$GITHUB_SHA
26-
-e DOC_TOKEN='$DOC_TOKEN'
26+
--env MODULEMD_VERSION=$modulemd_version
27+
--volume=$GITHUB_WORKSPACE:/builddir
2728
"
2829

29-
popd # $SCRIPT_DIR
30+
popd # $SCRIPT_DIR

.ci/docs/ci-tasks.sh

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,11 @@ pushd doc-generation/modulemd/html
2626
/builddir/contrib/doc-tools/fix-xref.sh
2727
popd
2828

29-
$RETRY_CMD git clone https://sgallagher:$DOC_TOKEN@github.com/fedora-modularity/fedora-modularity.github.io
30-
rsync -avh --delete-before --no-perms --omit-dir-times /builddir/doc-generation/modulemd/html/* fedora-modularity.github.io/libmodulemd/latest
29+
MODULEMD_VERSION=${MODULEMD_VERSION:-latest}
3130

32-
pushd fedora-modularity.github.io
33-
34-
git add libmodulemd/latest
35-
36-
# Check to see if there are any changes
37-
set +e
38-
git commit -m "Updating libmodulemd docs for $GITHUB_SHA" --dry-run
39-
err=$?
40-
if [ $err = 0 ]; then
41-
set -e
42-
git config user.name "Libmodulemd CI"
43-
git config user.email "[email protected]"
44-
git commit -m "Updating libmodulemd docs for $GITHUB_SHA"
45-
$RETRY_CMD git push origin master
46-
fi
47-
set -e
48-
49-
popd #fedora-modularity.github.io
31+
mkdir -p /builddir/fedora-modularity.github.io/libmodulemd/$MODULEMD_VERSION
32+
rsync -avh --delete-before --no-perms --omit-dir-times \
33+
/builddir/doc-generation/modulemd/html/* \
34+
/builddir/fedora-modularity.github.io/libmodulemd/$MODULEMD_VERSION
5035

5136
popd #builddir

.github/workflows/upstreamed.yaml

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ jobs:
77
static_analysis:
88
name: Static Analysis
99
runs-on: ubuntu-20.04
10+
if: github.repository == 'fedora-modularity/libmodulemd'
1011
steps:
1112
- name: Checkout code
1213
uses: actions/checkout@v2
@@ -20,12 +21,34 @@ jobs:
2021
docs:
2122
name: Publish Documentation
2223
runs-on: ubuntu-20.04
24+
continue-on-error: false
25+
if: github.repository == 'fedora-modularity/libmodulemd'
2326
steps:
24-
- name: Checkout code
27+
- name: Checkout code repo
2528
uses: actions/checkout@v2
2629

27-
- name: Publish
28-
env:
29-
DOC_TOKEN: ${{ secrets.DOC_TOKEN }}
30+
- name: Checkout documentation repo
31+
uses: actions/checkout@v2
32+
with:
33+
repository: fedora-modularity/fedora-modularity.github.io
34+
ref: main
35+
path: fedora-modularity.github.io
36+
token: ${{ secrets.DOC_TOKEN }}
37+
38+
39+
- name: Generate documentation
3040
run: |
3141
./.ci/ci-docs.sh
42+
43+
- name: Commit documentation
44+
uses: EndBug/add-and-commit@v6
45+
with:
46+
branch: main
47+
token: ${{ secrets.DOC_TOKEN }}
48+
cwd: fedora-modularity.github.io
49+
author_name: Libmodulemd CI
50+
author_email: [email protected]
51+
message: Updating libmodulemd docs for ${{ github.sha }}
52+
add: libmodulemd/latest
53+
signoff: true
54+
push: true

0 commit comments

Comments
 (0)