You've already forked documentation
mirror of
https://github.com/armbian/documentation.git
synced 2026-01-06 10:13:36 -08:00
Add various GH actions and enable upload to new WEB server (#666)
* `Automatic` documentation update * `Automatic` documentation update * Enable upload to new server * Pull useful actions from build repository * Update .github/workflows/clean-workflow-logs.yml * Update clean-workflow-logs.yml * Fix docs preview * Refactor docs at pr
This commit is contained in:
20
.github/labeler.yml
vendored
Normal file
20
.github/labeler.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
# This configures label matching for PR's.
|
||||
#
|
||||
# The keys are labels, and the values are lists of minimatch patterns
|
||||
# to which those labels apply.
|
||||
#
|
||||
# NOTE: This can only add labels, not remove them.
|
||||
# NOTE: Due to YAML syntax limitations, patterns or labels which start
|
||||
# with a character that is part of the standard YAML syntax must be
|
||||
# quoted.
|
||||
#
|
||||
# Please keep the labels sorted and deduplicated.
|
||||
|
||||
"Needs review":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: '**'
|
||||
|
||||
"GitHub Actions":
|
||||
- all:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: ['.github/**/**/*']
|
||||
66
.github/labels.yml
vendored
Normal file
66
.github/labels.yml
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
- name: "02"
|
||||
color: "76B4D9"
|
||||
description: "Milestone: First quarter release"
|
||||
- name: "05"
|
||||
color: "AADB79"
|
||||
description: "Milestone: Second quarter release"
|
||||
- name: "08"
|
||||
color: "4B649F"
|
||||
description: "Milestone: Third quarter release"
|
||||
- name: "11"
|
||||
color: "D58125"
|
||||
description: "Milestone: Fourth quarter release"
|
||||
- name: "Backlog"
|
||||
color: "d4c5f9"
|
||||
description: "Stalled work that needs to be completed"
|
||||
- name: "Bug"
|
||||
color: "F92C01"
|
||||
description: "Something isn't working as it should"
|
||||
- name: "Discussion"
|
||||
color: "EDFFE3"
|
||||
description: "Being discussed - Voice your opinions :)"
|
||||
- name: "Duplicate"
|
||||
color: "f4bd13"
|
||||
description: "Issue is already present"
|
||||
- name: "Good first issue"
|
||||
color: "ffb3ff"
|
||||
description: "Feel free to contribute :) "
|
||||
- name: "User error"
|
||||
color: "CD456C"
|
||||
description: "A mistake that is made by the user"
|
||||
- name: "size/small"
|
||||
color: "ededed"
|
||||
description: "PR with less then 50 lines"
|
||||
- name: "size/medium"
|
||||
color: "ededed"
|
||||
description: "PR with more then 50 and less then 250 lines"
|
||||
- name: "size/large"
|
||||
color: "ededed"
|
||||
description: "PR with 250 lines or more"
|
||||
- name: "Task/To-Do"
|
||||
color: "2f95f1"
|
||||
description: "Project management: To-Do or task(s) someone is working on"
|
||||
- name: "GitHub Actions"
|
||||
color: "bfd4f2"
|
||||
description: "GitHub Actions code"
|
||||
- name: "Work in progress"
|
||||
color: "29E414"
|
||||
description: "Unfinished / work in progress"
|
||||
- name: "Ready to merge"
|
||||
color: "1d7136"
|
||||
description: "Reviewed, tested and ready for merge"
|
||||
- name: "Help needed"
|
||||
color: "EA1BCE"
|
||||
description: "We need your involvement"
|
||||
- name: "Needs review"
|
||||
color: "AEE054"
|
||||
description: "Seeking for review"
|
||||
- name: "Can be closed?"
|
||||
color: "9b75fc"
|
||||
description: "Ping developers on stalled issue / PR"
|
||||
- name: "Documentation finished"
|
||||
color: "0052CC"
|
||||
description: "New feature was properly added to docs"
|
||||
- name: "Improper usage"
|
||||
color: "CD456C"
|
||||
description: "Provided input is not in the expected data format or structure"
|
||||
28
.github/workflows/clean-workflow-logs.yml
vendored
Normal file
28
.github/workflows/clean-workflow-logs.yml
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
name: "Clean Workflow Logs"
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * 1" # Runs "At 00:00 on Monday." (see https://crontab.guru)
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
runs_older_than:
|
||||
description: "The amount of days old to delete"
|
||||
default: "21"
|
||||
required: false
|
||||
runs_to_keep:
|
||||
description: "The number of workflow runs to keep"
|
||||
default: "0"
|
||||
required: false
|
||||
env:
|
||||
SCHEDULED_RUNS_OLDER_THAN: "21"
|
||||
SCHEDULED_RUNS_TO_KEEP: "0"
|
||||
|
||||
jobs:
|
||||
clean-logs:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: write
|
||||
steps:
|
||||
- uses: igorjs/gh-actions-clean-workflow@v6
|
||||
with:
|
||||
runs_older_than: ${{ github.event.inputs.runs_older_than || env.SCHEDULED_RUNS_OLDER_THAN }}
|
||||
runs_to_keep: ${{ github.event.inputs.runs_to_keep || env.SCHEDULED_RUNS_TO_KEEP }}
|
||||
36
.github/workflows/labels-from-yml.yml
vendored
Normal file
36
.github/workflows/labels-from-yml.yml
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
name: Sync Labels from YAML
|
||||
run-name: Sync Labels from YML on ${{ github.event_name }}
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- "main"
|
||||
paths:
|
||||
- ".github/labels.yml"
|
||||
pull_request:
|
||||
paths:
|
||||
- ".github/labels.yml"
|
||||
|
||||
jobs:
|
||||
labeler:
|
||||
permissions:
|
||||
contents: read # for actions/labeler to determine modified files
|
||||
pull-requests: write # for actions/labeler to add labels to PRs
|
||||
issues: write # for actions/labeler to add labels to issues
|
||||
|
||||
if: ${{ github.repository_owner == 'Armbian' }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Run Labeler
|
||||
uses: crazy-max/ghaction-github-labeler@v5
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
yaml-file: .github/labels.yml
|
||||
dry-run: ${{ github.event_name == 'pull_request' }}
|
||||
exclude: |
|
||||
Maintenance*
|
||||
67
.github/workflows/pdf-at-pr.yaml
vendored
67
.github/workflows/pdf-at-pr.yaml
vendored
@@ -1,65 +1,74 @@
|
||||
# This workflow will install Python dependencies and generate PDF file at PR
|
||||
name: Create offline documentation on PR
|
||||
name: Create docs preview on PR
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, reopened, synchronize, labeled]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
docs-preview:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [ 3.8 ]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout PR branch (documentation)
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
path: documentation
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout `www` branch
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: www
|
||||
path: www
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
- name: Set up Python 3.8
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
python-version: 3.8
|
||||
|
||||
- name: Cache pip dependencies
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('documentation/requirements.txt') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: documentation
|
||||
run: |
|
||||
cd documentation
|
||||
python -m pip install --upgrade pip
|
||||
pip install setuptools wheel
|
||||
pip install -r requirements.txt
|
||||
|
||||
- name: Run mkdocs --clean
|
||||
- name: Build docs with MkDocs
|
||||
working-directory: documentation
|
||||
run: mkdocs build --clean
|
||||
|
||||
- name: Publish to `www` branch
|
||||
working-directory: www
|
||||
run: |
|
||||
|
||||
cd documentation
|
||||
mkdocs build --clean
|
||||
|
||||
- name: Push to web
|
||||
run: |
|
||||
|
||||
cd www
|
||||
mkdir -p "${{ github.event.number }}"
|
||||
rsync -av ../documentation/site/. ${{ github.event.number }}
|
||||
rsync -av ../documentation/site/. "${{ github.event.number }}"
|
||||
git config user.name github-actions
|
||||
git config user.email github-actions@github.com
|
||||
git add .
|
||||
git commit -m "Updating repo" || true
|
||||
git add .
|
||||
git commit -m "Update docs preview for PR #${{ github.event.number }}" || true
|
||||
git push origin www || true
|
||||
|
||||
- uses: devindford/Append_PR_Comment@v1.1.3
|
||||
- name: Comment on PR with preview link
|
||||
uses: devindford/Append_PR_Comment@v1.1.3
|
||||
with:
|
||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
body-template: |
|
||||
[](https://github.com/armbian/documentation/actions/workflows/pdf-at-pr.yaml)
|
||||
|
||||
[](https://github.com/armbian/documentation/actions/workflows/pdf-at-pr.yaml)
|
||||
Documentation website preview will be available in few minutes:
|
||||
<a href=https://armbian.github.io/documentation/${{ github.event.number }}><kbd> <br> Open WWW preview <br> </kbd></a>
|
||||
body-update-action: 'suffix'
|
||||
Documentation website preview will be available shortly:
|
||||
|
||||
<a href="https://armbian.github.io/documentation/${{ github.event.number }}"><kbd><br> Open WWW preview <br></kbd></a>
|
||||
body-update-action: suffix
|
||||
60
.github/workflows/pr-auto-labeler.yml
vendored
Normal file
60
.github/workflows/pr-auto-labeler.yml
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
name: Automatic Pull Request Labeling
|
||||
run-name: 'Set labels - PR #${{ github.event.pull_request.number }} ("${{ github.event.pull_request.title }}")'
|
||||
#
|
||||
# Set labels for pull requests automatically based on size (modified via job 'label-size') and file categories (modified via .github/labeler)
|
||||
#
|
||||
|
||||
on: pull_request_target
|
||||
|
||||
jobs:
|
||||
label-remove:
|
||||
permissions:
|
||||
contents: read # for pascalgn/size-label-action to determine modified files
|
||||
pull-requests: write # for pascalgn/size-label-action to add labels to PRs
|
||||
name: "Remove Ready to merge"
|
||||
if: ${{ github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'synchronize' }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: PauMAVA/add-remove-label-action@v1.0.3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
add: ""
|
||||
remove: "Ready to merge"
|
||||
|
||||
label-category:
|
||||
permissions:
|
||||
contents: read # for actions/labeler to determine modified files
|
||||
pull-requests: write # for actions/labeler to add labels to PRs
|
||||
|
||||
name: "Category labels"
|
||||
if: ${{ github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'synchronize' }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/labeler@v5
|
||||
with:
|
||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
|
||||
label-size:
|
||||
permissions:
|
||||
contents: read # for pascalgn/size-label-action to determine modified files
|
||||
pull-requests: write # for pascalgn/size-label-action to add labels to PRs
|
||||
|
||||
name: "Size label"
|
||||
if: ${{ github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'synchronize' }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: size-label
|
||||
uses: "pascalgn/size-label-action@v0.5.5"
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
with:
|
||||
sizes: >
|
||||
{
|
||||
"0": "small",
|
||||
"50": "medium",
|
||||
"250": "large"
|
||||
}
|
||||
105
.github/workflows/release.yaml
vendored
105
.github/workflows/release.yaml
vendored
@@ -1,84 +1,47 @@
|
||||
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
|
||||
|
||||
name: Create offline documentation to release
|
||||
name: Update documentation website
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
branches: [ main ]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
build-docs:
|
||||
name: "Generate HTML"
|
||||
if: ${{ github.repository_owner == 'Armbian' }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [ 3.8 ]
|
||||
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
with:
|
||||
ref: main
|
||||
fetch-depth: 1
|
||||
|
||||
- name: "Set up Python"
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install setuptools wheel
|
||||
pip install -r requirements.txt
|
||||
- name: Run mkdocs --clean
|
||||
run: |
|
||||
mkdocs build --clean
|
||||
python-version: 3.8
|
||||
|
||||
# - name: Upload pdf
|
||||
# uses: actions/upload-artifact@v4
|
||||
# with:
|
||||
# name: artifact
|
||||
# path: site/pdf/document.pdf
|
||||
# PDF is not built, no need to upload
|
||||
- name: "Install dependencies"
|
||||
run: |
|
||||
|
||||
pip install --upgrade pip
|
||||
pip install setuptools wheel -r requirements.txt
|
||||
|
||||
- name: "Build documentation"
|
||||
run: mkdocs build --clean
|
||||
|
||||
- name: "Install SSH key"
|
||||
uses: shimataro/ssh-key-action@v2
|
||||
with:
|
||||
key: ${{ secrets.KEY_UPLOAD }}
|
||||
known_hosts: ${{ secrets.HOST_APPLICATIONS_KNOWN_HOSTS }}
|
||||
if_key_exists: replace
|
||||
|
||||
- name: "Deploy to servers"
|
||||
timeout-minutes: 3
|
||||
run: |
|
||||
rsync -e "ssh -p ${{ secrets.HOST_APPLICATIONS_PORT }}" \
|
||||
-a site/ \
|
||||
${{ secrets.HOST_APPLICATIONS_USER }}@${{ secrets.HOST_APPLICATIONS }}:storage/docs.armbian.com
|
||||
|
||||
#deploy:
|
||||
#needs: [ build ]
|
||||
#runs-on: ubuntu-20.04
|
||||
#env:
|
||||
# TZ: GMT
|
||||
#steps:
|
||||
# - uses: actions/checkout@v4
|
||||
# - uses: actions/download-artifact@v4
|
||||
# with:
|
||||
# name: artifact
|
||||
# - name: Add
|
||||
# run: |
|
||||
# ls -l
|
||||
# git pull
|
||||
# git add document.pdf
|
||||
# - name: Commit files
|
||||
# run: |
|
||||
# git config --local user.email "info@armbian.com"
|
||||
# git config --local user.name "Armbianworker"
|
||||
# git commit --allow-empty -m "Update github actions" -a
|
||||
# - name: Push changes
|
||||
# uses: ad-m/github-push-action@master
|
||||
# with:
|
||||
# repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
# branch: ${{ github.ref }}
|
||||
#- name: Declare vars
|
||||
# id: vars
|
||||
# shell: bash
|
||||
# run: |
|
||||
# echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||
# echo "timenow=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
|
||||
#- name: Rename release artifact
|
||||
# shell: bash
|
||||
# run: |
|
||||
# mv -v document.pdf armbian-document-${{ steps.vars.outputs.sha_short }}.pdf
|
||||
#- name: Create Release
|
||||
# uses: ncipollo/release-action@v1
|
||||
# with:
|
||||
# tag: ${{ steps.vars.outputs.sha_short }}
|
||||
# name: ${{ steps.vars.outputs.timenow }}-${{ steps.vars.outputs.sha_short }}
|
||||
# draft: false
|
||||
# prerelease: false
|
||||
# token: ${{ secrets.GITHUB_TOKEN }}
|
||||
# artifacts: armbian-document-${{ steps.vars.outputs.sha_short }}.pdf
|
||||
# artifactContentType: application/pdf
|
||||
|
||||
Reference in New Issue
Block a user