Remove wiki from github (#216)
This commit is contained in:
82
.github/deploy_wiki.sh
vendored
82
.github/deploy_wiki.sh
vendored
@@ -1,82 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
function debug() {
|
||||
echo "::debug file=${BASH_SOURCE[0]},line=${BASH_LINENO[0]}::$1"
|
||||
}
|
||||
|
||||
function warning() {
|
||||
echo "::warning file=${BASH_SOURCE[0]},line=${BASH_LINENO[0]}::$1"
|
||||
}
|
||||
|
||||
function error() {
|
||||
echo "::error file=${BASH_SOURCE[0]},line=${BASH_LINENO[0]}::$1"
|
||||
}
|
||||
|
||||
function add_mask() {
|
||||
echo "::add-mask::$1"
|
||||
}
|
||||
|
||||
if [ -z "$GITHUB_ACTOR" ]; then
|
||||
error "GITHUB_ACTOR environment variable is not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$GITHUB_REPOSITORY" ]; then
|
||||
error "GITHUB_REPOSITORY environment variable is not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$GH_PERSONAL_ACCESS_TOKEN" ]; then
|
||||
error "GH_PERSONAL_ACCESS_TOKEN environment variable is not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$WIKI_PATH" ]; then
|
||||
echo "WIKI_PATH environment variable is not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
add_mask "${GH_PERSONAL_ACCESS_TOKEN}"
|
||||
|
||||
if [ -z "${WIKI_COMMIT_MESSAGE:-}" ]; then
|
||||
debug "WIKI_COMMIT_MESSAGE not set, using default"
|
||||
WIKI_COMMIT_MESSAGE='Automatically publish wiki'
|
||||
fi
|
||||
|
||||
GIT_REPOSITORY_URL="https://${GH_PERSONAL_ACCESS_TOKEN}@github.com/$GITHUB_REPOSITORY.wiki.git"
|
||||
|
||||
debug "Checking out wiki repository"
|
||||
tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX)
|
||||
(
|
||||
cd "$tmp_dir" || exit 1
|
||||
git init
|
||||
git config user.name "$GITHUB_ACTOR"
|
||||
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
||||
git pull "$GIT_REPOSITORY_URL"
|
||||
)
|
||||
|
||||
debug "Rsync contents of $WIKI_PATH"
|
||||
rsync -q -a --delete --exclude=.git "$GITHUB_WORKSPACE/$WIKI_PATH/" "$tmp_dir"
|
||||
|
||||
if [ ! -r "$tmp_dir/Home.md" ]; then
|
||||
debug "Copy README.md to wiki/Home.md"
|
||||
rsync -q -a "$GITHUB_WORKSPACE/README.md" "$tmp_dir/Home.md"
|
||||
fi
|
||||
|
||||
debug "Rewriting images path to absolute"
|
||||
(
|
||||
cd "$tmp_dir" || exit 1
|
||||
find . -type f -exec sed -Ei 's@([ (])([^( ]+)(\/wiki_static\/.+?\.(png|jpe?g|svg)[ \)])@\1https://github.com/Flipper-Zero/flipperzero-firmware-community/raw/master\3@' {} \;
|
||||
)
|
||||
|
||||
debug "Committing and pushing changes"
|
||||
(
|
||||
cd "$tmp_dir" || exit 1
|
||||
git add .
|
||||
git commit -m "$WIKI_COMMIT_MESSAGE"
|
||||
git push --set-upstream "$GIT_REPOSITORY_URL" master
|
||||
)
|
||||
|
||||
rm -rf "$tmp_dir"
|
||||
exit 0
|
||||
|
23
.github/workflows/publish_wiki.yml
vendored
23
.github/workflows/publish_wiki.yml
vendored
@@ -1,23 +0,0 @@
|
||||
name: Publish the wiki
|
||||
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
paths:
|
||||
- 'wiki/**'
|
||||
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@v1
|
||||
- name: Upload Documentation to Wiki
|
||||
run: bash ./.github/deploy_wiki.sh
|
||||
env:
|
||||
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
|
||||
WIKI_PATH: "wiki"
|
||||
|
Reference in New Issue
Block a user