Skip to content

Commit

Permalink
Build documentation with Github Actions
Browse files Browse the repository at this point in the history
Also ensures that static analysis and documentation generation will
occur only on the main branch of the upstream repository.

Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
  • Loading branch information
sgallagher committed Jan 14, 2021
1 parent e1bc0a4 commit fa66177
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 27 deletions.
7 changes: 4 additions & 3 deletions .ci/ci-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ source $SCRIPT_DIR/ci-common.inc
set -e
set -x

modulemd_version=${1:-latest}
os=fedora
release=32
repository=quay.io
Expand All @@ -22,8 +23,8 @@ mmd_run_docker_tests \
test_template="docs/Dockerfile.tmpl" \
test_image="libmodulemd-docs-$os:$release" \
oci_extra_args="
-e GITHUB_SHA=$GITHUB_SHA
-e DOC_TOKEN='$DOC_TOKEN'
--env MODULEMD_VERSION=$modulemd_version
--volume=$GITHUB_WORKSPACE:/builddir
"

popd # $SCRIPT_DIR
popd # $SCRIPT_DIR
25 changes: 5 additions & 20 deletions .ci/docs/ci-tasks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,11 @@ pushd doc-generation/modulemd/html
/builddir/contrib/doc-tools/fix-xref.sh
popd

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

pushd fedora-modularity.github.io

git add libmodulemd/latest

# Check to see if there are any changes
set +e
git commit -m "Updating libmodulemd docs for $GITHUB_SHA" --dry-run
err=$?
if [ $err = 0 ]; then
set -e
git config user.name "Libmodulemd CI"
git config user.email "sgallagh@redhat.com"
git commit -m "Updating libmodulemd docs for $GITHUB_SHA"
$RETRY_CMD git push origin master
fi
set -e

popd #fedora-modularity.github.io
mkdir -p /builddir/fedora-modularity.github.io/libmodulemd/$MODULEMD_VERSION
rsync -avh --delete-before --no-perms --omit-dir-times \
/builddir/doc-generation/modulemd/html/* \
/builddir/fedora-modularity.github.io/libmodulemd/$MODULEMD_VERSION

popd #builddir
31 changes: 27 additions & 4 deletions .github/workflows/upstreamed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ jobs:
static_analysis:
name: Static Analysis
runs-on: ubuntu-20.04
if: github.repository == 'fedora-modularity/libmodulemd'
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand All @@ -20,12 +21,34 @@ jobs:
docs:
name: Publish Documentation
runs-on: ubuntu-20.04
continue-on-error: false
if: github.repository == 'fedora-modularity/libmodulemd'
steps:
- name: Checkout code
- name: Checkout code repo
uses: actions/checkout@v2

- name: Publish
env:
DOC_TOKEN: ${{ secrets.DOC_TOKEN }}
- name: Checkout documentation repo
uses: actions/checkout@v2
with:
repository: fedora-modularity/fedora-modularity.github.io
ref: main
path: fedora-modularity.github.io
token: ${{ secrets.DOC_TOKEN }}


- name: Generate documentation
run: |
./.ci/ci-docs.sh
- name: Commit documentation
uses: EndBug/add-and-commit@v6
with:
branch: main
token: ${{ secrets.DOC_TOKEN }}
cwd: fedora-modularity.github.io
author_name: Libmodulemd CI
author_email: github-actions@github.com
message: Updating libmodulemd docs for ${{ github.sha }}
add: libmodulemd/latest
signoff: true
push: true

0 comments on commit fa66177

Please sign in to comment.