Skip to content

Replace image-bundler with k0s airgap bundle-artifacts #716

Replace image-bundler with k0s airgap bundle-artifacts

Replace image-bundler with k0s airgap bundle-artifacts #716

Workflow file for this run

name: Publish docs via GitHub Pages
on:
push:
branches:
- main
release:
types:
- published
env:
MAKEFLAGS: -j
CURL_OPTS: --proto =https --tlsv1.2 --retry 5 --retry-all-errors --silent --show-error --location --fail
jobs:
build:
name: Deploy docs
runs-on: ubuntu-latest
steps:
- name: Checkout k0s
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare build environment
run: .github/workflows/prepare-build-env.sh
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: pip
cache-dependency-path: docs/requirements.txt
- name: Install dependencies
run: |
pip install --disable-pip-version-check -r docs/requirements_pip.txt
pip --version
pip install --disable-pip-version-check -r docs/requirements.txt
k0sSortVersion=$(./vars.sh FROM=. k0s_sort_version)
mkdir -p build/cache/bin
curl $CURL_OPTS --output build/cache/bin/k0s_sort "https://github.com/k0sproject/version/releases/download/$k0sSortVersion/k0s_sort-linux-amd64"
chmod +x build/cache/bin/k0s_sort
printf '%s\n' "$(realpath build/cache/bin)" >>"$GITHUB_PATH"
- name: Generate docs
env:
GH_TOKEN: ${{ github.token }}
run: make -C docs docs clean-k0s
- name: git config
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
# This deploys the current docs into gh-pages/head on merges to main
# The old "main" gets deleted if it exists, head is more descriptive
- name: mike deploy head
if: contains(github.ref, 'refs/heads/main')
run: |
KUBERNETES_VERSION="$(./vars.sh kubernetes_version)" mike deploy --push head
# If a release has been published, deploy it as a new version
- name: mike deploy new version
if: >-
github.event_name == 'release' &&
github.event.action == 'published' &&
!github.event.release.draft &&
!github.event.release.prerelease
env:
VERSION: ${{ github.event.release.tag_name }}
run: |
KUBERNETES_VERSION="$(./vars.sh kubernetes_version)" mike deploy --push "$VERSION"
- name: Update mike version aliases
if: github.repository == 'k0sproject/k0s'
id: set_versions
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAGS=$(gh release list -L 1000 -R "$GITHUB_REPOSITORY" | grep "+k0s." | grep -v Draft | cut -f 1 | k0s_sort)
LATEST=$(echo "${TAGS}" | tail -1)
STABLE=$(echo "${TAGS}" | grep -v -- "-" | tail -1)
mike alias -u head main
mike alias -u "${STABLE}" stable
mike set-default --push stable
echo LATEST="$LATEST" >> $GITHUB_OUTPUT
echo STABLE="$STABLE" >> $GITHUB_OUTPUT
# Ensures the current branch is gh-pages,
# Creates / updates the "stable" and "latest" plain text files with the corresponding versions
# Commits if the files were changed
# Finally pushes if there are unpushed commits
- name: Create version files
if: github.repository == 'k0sproject/k0s'
run: |
LATEST=${{ steps.set_versions.outputs.LATEST }}
STABLE=${{ steps.set_versions.outputs.STABLE }}
cp .github/workflows/channel.yaml.tpl /tmp/tpl
git checkout gh-pages
echo "${STABLE}" > stable.txt
git add stable.txt && git update-index --refresh
git diff-index --quiet HEAD -- || git commit -m "Set stable to ${STABLE}"
echo "${LATEST}" > latest.txt
cat /tmp/tpl | sed "s/{{ .Version }}/${LATEST}/g" > edge_release
git add latest.txt edge_release && git update-index --refresh
git diff-index --quiet HEAD -- || git commit -m "Set latest to ${LATEST}"
git push origin gh-pages