Skip to content

Feat/idle timeouts (#3046) #130

Feat/idle timeouts (#3046)

Feat/idle timeouts (#3046) #130

#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: Publish Snapshot Docs to Website
on:
push:
branches: ["main"]
workflow_dispatch:
inputs:
branch:
description: 'The branch to checkout'
required: true
default: 'main'
type: string
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
- name: 'Test for Slack secret'
env:
KROXYLICIOUS_SLACK_WEBHOOK: ${{ secrets.KROXYLICIOUS_SLACK_WEBHOOK }}
run: |
echo "SLACK_WEBHOOK_SET=$(test ${KROXYLICIOUS_SLACK_WEBHOOK} && echo true)" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v6
with:
path: kroxylicious
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.branch || github.ref_name }}
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Build and install BOM
run: mvn clean install -pl :kroxylicious-bom
working-directory: kroxylicious
- name: Build with Maven
run: mvn -Dquick -P dist package --pl kroxylicious-docs
working-directory: kroxylicious
- name: Checkout Website
uses: actions/checkout@v6
with:
path: kroxylicious.github.io
repository: kroxylicious/kroxylicious.github.io
ref: main
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f
with:
driver-opts: network=host
- name: Build Docker image
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
with:
context: kroxylicious.github.io
push: true
tags: localhost:5000/kroxy-jekyll:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Load Jekyll configuration overrides
run: |
echo "baseurl: kroxylicious" > _config-baseurl.yml
echo "${{ vars.JEKYLL_CONFIG_OVERRIDES }}" > _config-overrides.yml
working-directory: kroxylicious.github.io
- name: copy built documentation into website
run: cp -r kroxylicious/kroxylicious-docs/target/web/* kroxylicious.github.io/
- name: Build with Jekyll
run: |
docker run \
--rm \
-u "$(id -u):$(id -g)" \
-v "$(pwd):/site" \
localhost:5000/kroxy-jekyll:latest \
bash -c 'eval "$(rbenv init -)" && cp -r /css/_sass/bootstrap /site/_sass/ && bundle exec jekyll build --config=_config.yml,_config-baseurl.yml,_config-overrides.yml'
working-directory: kroxylicious.github.io
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
path: kroxylicious.github.io/_site
retention-days: 14
- name: Slack Notification on Failure
if: failure() && env.SLACK_WEBHOOK_SET == 'true'
uses: rtCamp/action-slack-notify@e31e87e03dd19038e411e38ae27cbad084a90661 # v2
env:
SLACK_WEBHOOK: ${{ secrets.KROXYLICIOUS_SLACK_WEBHOOK }}
SLACK_COLOR: 'danger'
SLACK_TITLE: 'Failure Alert: ${{ github.repository }}'
SLACK_MESSAGE: 'The snapshot documentation build workflow failed.'
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: 'Test for Slack secret'
env:
KROXYLICIOUS_SLACK_WEBHOOK: ${{ secrets.KROXYLICIOUS_SLACK_WEBHOOK }}
run: |
echo "SLACK_WEBHOOK_SET=$(test ${KROXYLICIOUS_SLACK_WEBHOOK} && echo true)" >> $GITHUB_ENV
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Slack Notification on Failure
if: failure() && env.SLACK_WEBHOOK_SET == 'true'
uses: rtCamp/action-slack-notify@e31e87e03dd19038e411e38ae27cbad084a90661 # v2
env:
SLACK_WEBHOOK: ${{ secrets.KROXYLICIOUS_SLACK_WEBHOOK }}
SLACK_COLOR: 'danger'
SLACK_TITLE: 'Failure Alert: ${{ github.repository }}'
SLACK_MESSAGE: 'The snapshot documentation deployment workflow failed.'