mirror of
https://github.com/ClementTsang/bottom.git
synced 2026-05-04 14:00:38 +00:00
docs: add nightly release redirect hook (#1928)
* docs: update copyright year * docs: add nightly release redirect * trigger docs in nightly * workflow_call * chmod * fix for potential time delay? * fix post release too * prune runs that ran today too * update docs
This commit is contained in:
@@ -4,6 +4,13 @@ name: docs
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
workflow_call:
|
||||
inputs:
|
||||
nightly:
|
||||
description: "Optional nightly redirect override"
|
||||
default: ""
|
||||
required: false
|
||||
type: string
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
@@ -37,6 +44,8 @@ jobs:
|
||||
run: ./scripts/ci/configure_git.sh
|
||||
|
||||
- name: Build and deploy docs with mike
|
||||
env:
|
||||
MKDOCS_NIGHTLY_RELEASE_OVERRIDE: ${{ inputs.nightly || '' }}
|
||||
run: |
|
||||
cd docs
|
||||
mike deploy nightly --push
|
||||
|
||||
@@ -56,6 +56,8 @@ jobs:
|
||||
name: upload-release
|
||||
needs: build-release
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
TAG_NAME: ${{ steps.tag_release_name.outputs.TAG_NAME }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
||||
@@ -74,12 +76,29 @@ jobs:
|
||||
echo "Generated $(ls ./release | wc -l) files:"
|
||||
du -h -d 0 ./release/*
|
||||
|
||||
- name: Create and set tag name and release name
|
||||
if: github.event.inputs.isMock != 'true'
|
||||
id: tag_release_name
|
||||
run: |
|
||||
COMMIT_HASH=$(git rev-parse --short=8 HEAD)
|
||||
TIME=$(date +%s)
|
||||
TAG_NAME=$(echo "nightly-$COMMIT_HASH-$TIME")
|
||||
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
|
||||
echo "TAG_NAME=$$TAG_NAME" >> "$GITHUB_OUTPUT"
|
||||
echo "$TAG_NAME"
|
||||
|
||||
DATE=$(date '+%Y-%m-%d')
|
||||
RELEASE_NAME=$(echo "Nightly ($DATE)")
|
||||
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
|
||||
echo "$RELEASE_NAME"
|
||||
|
||||
# Delete tags older than 3 days, as well as nightly runs that are a duplicate of today.
|
||||
- name: Delete old tags and release if not mock
|
||||
if: github.event.inputs.isMock != 'true'
|
||||
run: |
|
||||
THREE_DAYS_AGO=$(date +%s --date='3 days ago')
|
||||
while true; do
|
||||
PREV_NIGHTLY=$(gh release list --json name,tagName,publishedAt | jq --arg THREE_DAYS_AGO "$THREE_DAYS_AGO" -c '[.[] | select (.tagName | contains("nightly-")) | select (.publishedAt | fromdateiso8601 > $THREE_DAYS_AGO)][0] | .tagName' | tr -d '"')
|
||||
PREV_NIGHTLY=$(gh release list --json name,tagName,publishedAt | jq --arg THREE_DAYS_AGO "$THREE_DAYS_AGO" --arg RELEASE_NAME "$RELEASE_NAME" -c '[.[] | select (.tagName | contains("nightly-")) | select ((.publishedAt | fromdateiso8601 > $THREE_DAYS_AGO) or (.name == $RELEASE_NAME))][0] | .tagName' | tr -d '"')
|
||||
|
||||
if [[ "$PREV_NIGHTLY" != "null" && "$PREV_NIGHTLY" == *"nightly-"* ]]; then
|
||||
echo "Will delete nightly release with tag '$PREV_NIGHTLY'";
|
||||
@@ -92,20 +111,6 @@ jobs:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Create and set tag name and release name
|
||||
if: github.event.inputs.isMock != 'true'
|
||||
run: |
|
||||
COMMIT_HASH=$(git rev-parse --short=8 HEAD)
|
||||
TIME=$(date +%s)
|
||||
TAG_NAME=$(echo "nightly-$COMMIT_HASH-$TIME")
|
||||
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
|
||||
echo "$TAG_NAME"
|
||||
|
||||
DATE=$(date '+%Y-%m-%d')
|
||||
RELEASE_NAME=$(echo "Nightly ($DATE)")
|
||||
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
|
||||
echo "$RELEASE_NAME"
|
||||
|
||||
# As a workaround to immutable releases, we create it as a draft first, then manually publish it after.
|
||||
- name: Add all release files and create nightly release if not mock
|
||||
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # 2.0.8
|
||||
@@ -125,3 +130,11 @@ jobs:
|
||||
run: gh release edit "$TAG_NAME" --draft=false
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
docs:
|
||||
needs: [initialize-job, upload-release]
|
||||
if: ${{ needs.initialize-job.outputs.should_skip != 'true' && github.event.inputs.isMock != 'true' }}
|
||||
uses: ./.github/workflows/docs.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
nightly: ${{needs.job1.outputs.output1}}
|
||||
|
||||
@@ -66,13 +66,8 @@ jobs:
|
||||
- name: Install Python dependencies
|
||||
run: pip install -r docs/requirements.txt
|
||||
|
||||
# TODO: Test this with the script instead
|
||||
- name: Configure git user and email
|
||||
run: |
|
||||
git config --global user.name ${GIT_USER}
|
||||
git config --global user.email ${GIT_EMAIL}
|
||||
echo Name: $(git config --get user.name)
|
||||
echo Email: $(git config --get user.email)
|
||||
run: ./scripts/ci/configure_git.sh
|
||||
|
||||
# TODO: Test this with the script instead
|
||||
- name: Build and deploy docs with mike as the latest stable branch
|
||||
|
||||
@@ -216,7 +216,7 @@ yay -S bottom-git
|
||||
### Debian / Ubuntu
|
||||
|
||||
A `.deb` file is provided on each [stable release](https://github.com/ClementTsang/bottom/releases/latest) and
|
||||
[nightly builds](https://github.com/ClementTsang/bottom/releases) for x86, aarch64, and armv7.
|
||||
[nightly builds](https://bottom.pages.dev/nightly/nightly-release) for x86, aarch64, and armv7.
|
||||
Some examples of installing it this way:
|
||||
|
||||
```bash
|
||||
@@ -425,8 +425,8 @@ mise use -g bottom@latest
|
||||
|
||||
You can also use the pre-built release binaries:
|
||||
|
||||
- [Latest stable release](https://github.com/ClementTsang/bottom/releases/latest), built using the release branch
|
||||
- [Latest nightly release](https://github.com/ClementTsang/bottom/releases), built using the `main` branch at 00:00 UTC daily
|
||||
- [Latest stable release](https://github.com/ClementTsang/bottom/releases/latest), which is built with what is in the [release branch](https://github.com/ClementTsang/bottom/tree/release).
|
||||
- [Latest nightly release](https://bottom.pages.dev/nightly/nightly-release), built using the `main` branch at 00:00 UTC daily or manually triggered
|
||||
|
||||
To use, download and extract the binary that matches your system. You can then run by doing:
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
site/
|
||||
venv/
|
||||
.cache/
|
||||
hooks/__pycache__/
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
bottom currently has two main deploy processes to worry about:
|
||||
|
||||
- [Nightly](https://github.com/ClementTsang/bottom/blob/main/.github/workflows/nightly.yml): a daily (00:00 UTC) GitHub action to build binary/installer files, and upload them to the [nightly release](https://github.com/ClementTsang/bottom/releases). It can also be triggered manually as either a proper nightly release or a mock release.
|
||||
- [Nightly](https://github.com/ClementTsang/bottom/blob/main/.github/workflows/nightly.yml): a daily (00:00 UTC) GitHub action to build binary/installer files, and upload them to the nightly release ([example](https://bottom.pages.dev/nightly/nightly-release)). It can also be triggered manually as either a proper nightly release or a mock release.
|
||||
- [Stable](https://github.com/ClementTsang/bottom/blob/main/.github/workflows/deployment.yml): a stable deployment, triggered manually or upon creation of a valid tag. This is a GitHub action that builds binary/installer files and uploads them to a new GitHub release.
|
||||
|
||||
Furthermore, this workflow does not handle the following deployments, which must be manually handled:
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<!-- Intentionally empty file, used for redirects -->
|
||||
@@ -80,36 +80,37 @@ Let's say you're installing [Iosevka](https://github.com/be5invis/Iosevka). The
|
||||
|
||||
## Why can't I see all my temperature sensors on Windows?
|
||||
|
||||
This is a [known limitation](./support/official.md#windows), some sensors may require admin privileges to get sensor data.
|
||||
This is a known issue, some sensors may require admin privileges to get sensor data.
|
||||
|
||||
## Why don't I see dual batteries on Windows reported separately? (e.g. Thinkpads)
|
||||
|
||||
This is a [known limitation](./support/official.md#windows) which seems to be with how batteries are being detected on Windows.
|
||||
This is a known issue which seems to be with how batteries are being detected on Windows.
|
||||
|
||||
## Why can't I see all my temperature sensors on WSL?
|
||||
|
||||
This is a [known limitation](./support/official.md#windows) with WSL. Due to how it works, hosts may not expose their
|
||||
This is a known limitation with WSL. Due to how it works, hosts may not expose their
|
||||
temperature sensors and therefore, temperature sensors might be missing.
|
||||
|
||||
## Why does WSL2 not match Task Manager?
|
||||
|
||||
This is a [known limitation](./support/official.md#windows) with WSL2. Due to how WSL2 works, the two might not match
|
||||
This is a known limitation with WSL2. Due to how WSL2 works, the two might not match
|
||||
up in terms of reported data.
|
||||
|
||||
## Why can't I see all my processes/process data on macOS?
|
||||
|
||||
This is a [known limitation](./support/official.md#macos), and you may have to run the program with elevated
|
||||
privileges to work around it - for example:
|
||||
You may have to run the program with elevated privileges to work around it - for example:
|
||||
|
||||
```bash
|
||||
sudo btm
|
||||
```
|
||||
|
||||
**Please note that you should be certain that you trust any software you grant root privileges.**
|
||||
!!! Warning
|
||||
|
||||
There are measures taken to try to maximize the amount of information obtained without elevated privileges. For example,
|
||||
one can modify the instructions found on the [htop wiki](https://github.com/hishamhm/htop/wiki/macOS:-run-without-sudo)
|
||||
on how to run htop without sudo for bottom. However, **please** understand the potential security risks before doing so!
|
||||
Please note that you should be certain that you trust any software you grant root privileges.
|
||||
|
||||
There are measures taken to try to maximize the amount of information obtained without elevated privileges. For example,
|
||||
one can modify the instructions found on the [htop wiki](https://github.com/hishamhm/htop/wiki/macOS:-run-without-sudo)
|
||||
on how to run htop without sudo for bottom. However, **please** understand the potential security risks before doing so!
|
||||
|
||||
## My configuration file isn't working
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import os
|
||||
import mkdocs.plugins
|
||||
import urllib.request
|
||||
import json
|
||||
|
||||
|
||||
# Based on https://github.com/squidfunk/mkdocs-material/discussions/3758#discussioncomment-4397373
|
||||
|
||||
@mkdocs.plugins.event_priority(-50)
|
||||
def on_config(config):
|
||||
print("Running nightly release redirect hook...")
|
||||
try:
|
||||
nightly_tag_name = None
|
||||
override = os.environ.get('MKDOCS_NIGHTLY_RELEASE_OVERRIDE')
|
||||
|
||||
if override:
|
||||
nightly_tag_name = override
|
||||
else:
|
||||
with urllib.request.urlopen("https://api.github.com/repos/ClementTsang/bottom/releases") as response:
|
||||
raw_data = response.read()
|
||||
data = json.loads(raw_data.decode('utf-8'))
|
||||
|
||||
first_nightly = next(release for release in data if "nightly-" in release["tag_name"])
|
||||
nightly_tag_name = first_nightly["tag_name"]
|
||||
|
||||
redirect_plugin = config.get('plugins', {}).get('redirects')
|
||||
redirects = redirect_plugin.config.get('redirect_maps', {})
|
||||
|
||||
if nightly_tag_name is not None:
|
||||
nightly_release_url = f"https://github.com/ClementTsang/bottom/releases/tag/{nightly_tag_name}"
|
||||
|
||||
print(f"Updated nightly release redirect to point to {nightly_release_url}")
|
||||
redirects["nightly-release.md"] = nightly_release_url
|
||||
else:
|
||||
print("nightly tag name was not set by any means.")
|
||||
except Exception as e:
|
||||
print(f"error adjusting redirect, falling back to general releases page: {e}")
|
||||
+8
-1
@@ -9,7 +9,7 @@ docs_dir: "content/"
|
||||
repo_name: ClementTsang/bottom
|
||||
repo_url: https://github.com/ClementTsang/bottom
|
||||
edit_uri: "edit/main/docs/content/"
|
||||
copyright: Copyright © 2019 - 2024 Clement Tsang
|
||||
copyright: Copyright © 2019 - 2026 Clement Tsang
|
||||
|
||||
# Theming
|
||||
theme:
|
||||
@@ -137,12 +137,16 @@ plugins:
|
||||
- git-revision-date-localized:
|
||||
type: date
|
||||
- privacy
|
||||
- redirects:
|
||||
redirect_maps:
|
||||
nightly-release.md: "https://github.com/ClementTsang/bottom/releases"
|
||||
|
||||
extra:
|
||||
# Versioning
|
||||
version:
|
||||
provider: mike
|
||||
default: stable
|
||||
alias: true
|
||||
|
||||
# Navigation
|
||||
nav:
|
||||
@@ -185,3 +189,6 @@ nav:
|
||||
- "Build Process": contribution/development/build_process.md
|
||||
- "Deploy Process": contribution/development/deploy_process.md
|
||||
- "Troubleshooting": troubleshooting.md
|
||||
|
||||
hooks:
|
||||
- ./hooks/nightly_redirect.py
|
||||
@@ -3,4 +3,4 @@ mkdocs-material == 9.7.1
|
||||
mdx_truly_sane_lists == 1.3
|
||||
mike == 2.1.3
|
||||
mkdocs-git-revision-date-localized-plugin == 1.4.5
|
||||
|
||||
mkdocs-redirects == 1.2.2
|
||||
|
||||
+6
-6
@@ -2,21 +2,21 @@
|
||||
|
||||
set -e
|
||||
|
||||
VENV_PATH="./venv/"
|
||||
VENV_PATH="./.venv/"
|
||||
PYTHON_CMD=${1:-python}
|
||||
|
||||
if [ ! -d $VENV_PATH ]; then
|
||||
echo "venv not found, creating one using the command '${PYTHON_CMD}'...";
|
||||
$PYTHON_CMD -m venv venv;
|
||||
source ./venv/bin/activate;
|
||||
$PYTHON_CMD -m venv .venv;
|
||||
source $VENV_PATH/bin/activate;
|
||||
pip install --upgrade pip;
|
||||
pip install -r requirements.txt;
|
||||
./venv/bin/mkdocs serve;
|
||||
$VENV_PATH/bin/mkdocs serve;
|
||||
else
|
||||
echo "venv already found.";
|
||||
source ./venv/bin/activate;
|
||||
source $VENV_PATH/bin/activate;
|
||||
pip install --upgrade pip;
|
||||
pip install -r requirements.txt;
|
||||
./venv/bin/mkdocs serve;
|
||||
$VENV_PATH/bin/mkdocs serve;
|
||||
fi;
|
||||
|
||||
|
||||
Regular → Executable
Reference in New Issue
Block a user