Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 33 additions & 30 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,27 @@ on:

jobs:
check:
name: "Content check"
name: Content check
runs-on: ubuntu-latest
steps:
- name: "Checkout repo"
- name: Checkout repo
uses: actions/checkout@v6
with:
submodules: recursive

- name: "Check for obsolete wiki headers"
- name: Check for obsolete wiki headers
run: |
if grep -rEi "^wiki_[^ ]+: " source/; then
echo '/!\ Wiki headers are obsolete (see previous log entries)'
exit 2
fi

- name: "Check for obsolete feature headers"
- name: Check for obsolete feature headers
run: |
if grep -rEi "^feature_[^ ]+: " source/; then
echo '/!\ Feature headers are obsolete (see previous log entries)'
exit 2
fi

- name: "Check for non-breaking space in markdowns"
- name: Check for non-breaking space in markdowns
run: |
if grep -P '\xa0' `find source/ -name "*.md"` ; then
echo '/!\ nonbreaking spaces have been found within the markdown (see previous log entries)'
Expand All @@ -44,62 +42,67 @@ jobs:
# which means developers would always require bleeding edge versions not available on stable servers
# this is too simplistic and breaks deployment
# instead all changes are tested via CI on the same target OS and version than the production builder
- name: "Check for simplistic bundler requirement bump"
- name: Check for simplistic bundler requirement bump
run: |
if grep -E "^(RUBY VERSION|BUNDLED WITH)" Gemfile.lock; then
echo '/!\ please remove "RUBY VERSION" and "BUNDLED WITH" requirements in Gemfile.lock'
exit 2
fi

build:
name: "Build website"
name: Build website
needs: check
runs-on: ubuntu-latest
container: quay.io/centos/centos:stream9
steps:
- name: "Checkout repo"
- name: Checkout repo
uses: actions/checkout@v6
with:
submodules: recursive

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Install dependencies
run: |
dnf install -y git ruby-devel rubygems-devel gcc-c++ curl-devel rubygem-bundler patch zlib-devel redhat-rpm-config openssl nodejs make glibc-langpack-en

- name: Build container image
uses: docker/build-push-action@v7
with:
context: .
push: false
load: true
tags: ovirt-site:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Install bundler dependencies
env:
NOKOGIRI_USE_SYSTEM_LIBRARIES: true
run: |
bundle config --local path 'vendor/bundle'
bundle install --quiet

- name: Set up Jekyll cache
uses: actions/cache@v5
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}

- name: "Build website"
run: docker run --rm --mount type=bind,source=$(pwd),target=/srv/site ovirt-site build
- name: Build website
env:
LANG: en_US.UTF-8
LANGUAGE: en_US:en
LC_ALL: en_US.UTF-8
run: bundle exec jekyll build

- name: "Upload generated content"
- name: Upload generated content
uses: actions/upload-artifact@v7
with:
name: ovirt-site
if-no-files-found: error
path: |
_site

- name: "Run htmlproofer"
run: docker run --rm --mount type=bind,source=$(pwd),target=/srv/site --entrypoint "/bin/bash" ovirt-site -c "bundle exec ruby htmlproofer_test.rb"
- name: Run htmlproofer
env:
LANG: en_US.UTF-8
LANGUAGE: en_US:en
LC_ALL: en_US.UTF-8
run: bundle exec ruby htmlproofer_test.rb

deploy:
name: "Deploy website"
name: Deploy website
needs: build
runs-on: ubuntu-latest
steps:
- name: "Download generated content"
- name: Download generated content
uses: actions/download-artifact@v8
with:
name: ovirt-site
Expand Down
107 changes: 66 additions & 41 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,39 @@
name: "Preview build"

permissions:
issues: write
pull-requests: write
contents: write
pages: write

on:
pull_request:

jobs:
check:
name: "Content check"
name: Content check
runs-on: ubuntu-latest
steps:
- name: "Checkout repo"
uses: actions/checkout@v4
- name: Checkout repo
uses: actions/checkout@v6
with:
submodules: recursive

- name: "Check for obsolete wiki headers"
- name: Check for obsolete wiki headers
run: |
if grep -rEi "^wiki_[^ ]+: " source/; then
echo '/!\ Wiki headers are obsolete (see previous log entries)'
exit 2
fi

- name: "Check for obsolete feature headers"
- name: Check for obsolete feature headers
run: |
if grep -rEi "^feature_[^ ]+: " source/; then
echo '/!\ Feature headers are obsolete (see previous log entries)'
exit 2
fi

- name: "Check for non-breaking space in markdowns"
- name: Check for non-breaking space in markdowns
run: |
if grep -P '\xa0' `find source/ -name "*.md"` ; then
echo '/!\ nonbreaking spaces have been found within the markdown (see previous log entries)'
Expand All @@ -41,26 +44,27 @@ jobs:
# which means developers would always require bleeding edge versions not available on stable servers
# this is too simplistic and breaks deployment
# instead all changes are tested via CI on the same target OS and version than the production builder
- name: "Check for simplistic bundler requirement bump"
- name: Check for simplistic bundler requirement bump
run: |
if grep -E "^(RUBY VERSION|BUNDLED WITH)" Gemfile.lock; then
echo '/!\ please remove "RUBY VERSION" and "BUNDLED WITH" requirements in Gemfile.lock'
exit 2
fi

build:
name: "Build preview"
name: Build preview
runs-on: ubuntu-latest
container: quay.io/centos/centos:stream9
outputs:
PR_ID: ${{steps.details.outputs.PR_ID}}
PREVIEW_PATH: ${{steps.details.outputs.PREVIEW_PATH}}
PREVIEW_LINK: ${{steps.details.outputs.PREVIEW_LINK}}
PREVIEW_LINK_PATH: ${{steps.details.outputs.PREVIEW_LINK_PATH}}
PREVIEW_LINK_BASE: ${{steps.details.outputs.PREVIEW_LINK_BASE}}
steps:
- name: "Checkout repo"
uses: actions/checkout@v4
with:
submodules: recursive
- name: Checkout repo
uses: actions/checkout@v6

- name: Extract PR details
id: details
run: |
Expand All @@ -74,6 +78,7 @@ jobs:
echo "PREVIEW_LINK=${PREVIEW_LINK}" >> $GITHUB_OUTPUT
echo "PREVIEW_LINK_PATH=${PREVIEW_LINK_PATH}" >> $GITHUB_OUTPUT
echo "PREVIEW_LINK_BASE=${PREVIEW_LINK_BASE}" >> $GITHUB_OUTPUT

- name: Comment on PR
continue-on-error: true
run: |
Expand All @@ -82,23 +87,25 @@ jobs:
gh pr comment ${{steps.details.outputs.PR_ID}} -F /tmp/comment
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build container image
uses: docker/build-push-action@v6
with:
context: .
push: false
load: true
tags: ovirt-site:latest
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Install dependencies
run: |
dnf install -y git ruby-devel rubygems-devel gcc-c++ curl-devel rubygem-bundler patch zlib-devel redhat-rpm-config openssl nodejs make glibc-langpack-en

- name: Install bundler dependencies
env:
NOKOGIRI_USE_SYSTEM_LIBRARIES: true
run: |
bundle config --local path 'vendor/bundle'
bundle install --quiet

- name: Set up Jekyll cache
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
- name: "Change config"

- name: Change config
run: |
set -exuo pipefail
sed -i -e "s#@PREVIEW_LINK_PATH@#${{steps.details.outputs.PREVIEW_LINK_PATH}}#" htmlproofer_test.rb
Expand All @@ -107,22 +114,34 @@ jobs:
sed -i -e "s#^url: .*#url: ${{steps.details.outputs.PREVIEW_LINK_BASE}}#" _config.yml
sed -i -e "s#site-baseurl: /#site-baseurl: ${{steps.details.outputs.PREVIEW_LINK_PATH}}#" _config.yml
cat _config.yml
- name: "Build website"
run: docker run --rm --mount type=bind,source=$(pwd),target=/srv/site ovirt-site build
- name: "Upload generated content"
uses: actions/upload-artifact@v4

- name: Build website
env:
LANG: en_US.UTF-8
LANGUAGE: en_US:en
LC_ALL: en_US.UTF-8
run: bundle exec jekyll build

- name: Upload generated content
uses: actions/upload-artifact@v7
with:
name: ovirt-site
if-no-files-found: error
path: |
_site
- name: "Run htmlproofer"
run: docker run --rm --mount type=bind,source=$(pwd),target=/srv/site --entrypoint "/bin/bash" ovirt-site -c "bundle exec ruby htmlproofer_test.rb"

- name: Run htmlproofer
env:
LANG: en_US.UTF-8
LANGUAGE: en_US:en
LC_ALL: en_US.UTF-8
run: bundle exec ruby htmlproofer_test.rb

publish:
permissions:
contents: write
pull-requests: write
name: "Publish preview"
name: Publish preview
runs-on: ubuntu-latest
needs:
- check
Expand All @@ -131,25 +150,30 @@ jobs:
group: ovirt-site-preview-build
cancel-in-progress: false
steps:
- name: set git defaults
- 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 repo"
uses: actions/checkout@v4

- name: Checkout repo
uses: actions/checkout@v6
with:
ref: gh-pages
token: "${{ secrets.GITHUB_TOKEN }}"
- name: "Remove preview build directory"

- name: Remove preview build directory
run: rm -rf "${{needs.build.outputs.PREVIEW_PATH}}"
- name: "Create preview build directory"

- name: Create preview build directory
run: mkdir -p "${{needs.build.outputs.PREVIEW_PATH}}"
- name: "Download generated content"
uses: actions/download-artifact@v4

- name: Download generated content
uses: actions/download-artifact@v8
with:
name: ovirt-site
path: "${{needs.build.outputs.PREVIEW_PATH}}"
- name: "Commit changes"

- name: Commit changes
run: |
commit=$(git log --format="%H" -n 1)
description=$(git describe --always)
Expand All @@ -161,7 +185,8 @@ jobs:
fi
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: "Send comment to PR"

- name: Send comment to PR
continue-on-error: true
run: |
echo "Your preview build is ready! ✨ Check the following link in 1-2 minutes: ${{needs.build.outputs.PREVIEW_LINK}} ." >/tmp/comment
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/remove-preview.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
name: Remove preview

permissions:
issues: write
pull-requests: write
contents: write

on:
pull_request:
types:
- closed

jobs:
remove:
name: "Remove preview build"
name: Remove preview build
runs-on: ubuntu-latest
concurrency:
group: ovirt-site-preview-build
Expand All @@ -19,11 +22,13 @@ jobs:
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'

- name: Checkout gh-pages branch
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
ref: gh-pages
token: ${{ secrets.GITHUB_TOKEN }}

- name: Extract PR details
id: details
run: |
Expand All @@ -37,6 +42,7 @@ jobs:
echo "PREVIEW_LINK=${PREVIEW_LINK}" >> $GITHUB_OUTPUT
echo "PREVIEW_LINK_PATH=${PREVIEW_LINK_PATH}" >> $GITHUB_OUTPUT
echo "PREVIEW_LINK_BASE=${PREVIEW_LINK_BASE}" >> $GITHUB_OUTPUT

- name: Comment on PR
continue-on-error: true
run: |
Expand All @@ -45,8 +51,10 @@ jobs:
gh pr comment ${{steps.details.outputs.PR_ID}} -F /tmp/comment
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

- name: Remove branch preview
run: rm -rf ${{steps.details.outputs.PREVIEW_PATH}}

- name: Commit changes
run: |
git add .
Expand Down
Empty file removed .gitmodules
Empty file.
Loading
Loading