Fix markup in deploying CA cert with REX (#3449) #28
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: deploy | |
on: | |
push: | |
branches: | |
- master | |
- "[0-9]+.[0-9]+" | |
pull_request: | |
branches: | |
- master | |
- "[0-9]+.[0-9]+" | |
env: | |
RUBY_VERSION: 3.1 | |
BUNDLE_WITHOUT: "nanoc" | |
MAKE_J: 3 | |
jobs: | |
build-ccutil: | |
runs-on: ubuntu-22.04 | |
container: | |
image: quay.io/ivanhorvath/ccutil:amazing | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Compile html-single | |
run: make -C guides ccutil -j ${{ env.MAKE_J }} | |
build-html: | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
shell: bash | |
working-directory: guides | |
steps: | |
- name: Get branch name (merge) | |
if: github.event_name != 'pull_request' | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV | |
working-directory: . | |
- name: Get branch name (pull request) | |
if: github.event_name == 'pull_request' | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV | |
working-directory: . | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ env.RUBY_VERSION }} | |
bundler-cache: true | |
- name: Build HTML with real links | |
run: | | |
make clean | |
make -j ${{ env.MAKE_J }} html BUILD=foreman-el | |
make -j ${{ env.MAKE_J }} html BUILD=foreman-deb | |
make -j ${{ env.MAKE_J }} html BUILD=katello | |
make -j ${{ env.MAKE_J }} html BUILD=satellite | |
make -j ${{ env.MAKE_J }} html BUILD=orcharhino | |
- name: Upload HTML | |
uses: actions/upload-artifact@v4 | |
with: | |
name: foreman-docs-html-${{ env.BRANCH_NAME }} | |
path: guides/build/ | |
pr-metadata: | |
runs-on: ubuntu-22.04 | |
if: github.event_name == 'pull_request' | |
steps: | |
- name: Get branch name (pull request) | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV | |
- name: Set target name (master) | |
if: github.base_ref == 'master' | |
run: echo "TARGET_NAME=nightly" >> $GITHUB_ENV | |
- name: Set target name (stable branch) | |
if: github.base_ref != 'master' | |
run: echo "TARGET_NAME=$(echo ${GITHUB_BASE_REF} | tr / -)" >> $GITHUB_ENV | |
- name: Save PR metadata | |
run: | | |
mkdir -p ./pr | |
echo '{"pr_number": ${{ github.event.number }}, "branch_name": "${{ env.BRANCH_NAME }}", "target_name": "${{ env.TARGET_NAME }}", "head_sha": "${{ github.event.pull_request.head.sha }}"}' > ./pr/pr.json | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: pr | |
path: ./pr/ | |
build-html-base: | |
runs-on: ubuntu-22.04 | |
if: github.event_name == 'pull_request' | |
defaults: | |
run: | |
shell: bash | |
working-directory: guides | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.base_ref }} | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ env.RUBY_VERSION }} | |
bundler-cache: true | |
- name: Build HTML base for comparison | |
run: | | |
make clean | |
make -j ${{ env.MAKE_J }} html BUILD=foreman-el | |
make -j ${{ env.MAKE_J }} html BUILD=foreman-deb | |
make -j ${{ env.MAKE_J }} html BUILD=katello | |
make -j ${{ env.MAKE_J }} html BUILD=satellite | |
make -j ${{ env.MAKE_J }} html BUILD=orcharhino | |
- name: Upload HTML base for comparison | |
uses: actions/upload-artifact@v4 | |
with: | |
name: foreman-docs-html-base | |
path: guides/build/ | |
build-web: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: master | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ env.RUBY_VERSION }} | |
bundler-cache: true | |
working-directory: ./web | |
- name: Build site with nanoc | |
run: bundle exec nanoc | |
working-directory: ./web | |
- name: Upload web | |
uses: actions/upload-artifact@v4 | |
with: | |
name: foreman-docs-web-master | |
path: web/output/ | |
publish: | |
if: > | |
github.repository_owner == 'theforeman' && | |
(github.ref == 'refs/heads/master' || | |
startsWith(github.ref, 'refs/heads/2.') || | |
startsWith(github.ref, 'refs/heads/3.')) | |
needs: | |
- build-html | |
- build-web | |
- build-ccutil | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Get branch name (merge) | |
if: github.event_name != 'pull_request' | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV | |
- name: Get branch name (pull request) | |
if: github.event_name == 'pull_request' | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV | |
- name: Create public directory | |
run: mkdir -p public/${{ env.BRANCH_NAME }} | |
- name: Download web (only for master) | |
if: github.ref == 'refs/heads/master' | |
uses: actions/download-artifact@v4 | |
with: | |
name: foreman-docs-web-${{ env.BRANCH_NAME }} | |
path: public | |
- name: Download HTML | |
uses: actions/download-artifact@v4 | |
with: | |
name: foreman-docs-html-${{ env.BRANCH_NAME }} | |
path: public/${{ env.BRANCH_NAME }} | |
- name: Rename master to nightly | |
if: github.ref == 'refs/heads/master' | |
run: mv master nightly | |
working-directory: ./public | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./public | |
keep_files: true |