Skip to content

Create commonErrors.md (#414) #378

Create commonErrors.md (#414)

Create commonErrors.md (#414) #378

Workflow file for this run

name: Wiki Deploy
on:
push:
branches:
- dev
- prod
jobs:
build:
name: Build wiki
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
env:
GH_TOKEN: ${{ github.token }}
run: |-
gh release download -R rust-lang/mdBook -p mdbook-*-x86_64-unknown-linux-gnu.tar.gz
gh release download -R tommilligan/mdbook-admonish -p mdbook-admonish-*-x86_64-unknown-linux-gnu.tar.gz
gh release download -R NilPointer-Software/mdbook-discord-components -p mdbook-discord-components-*.tar.gz
for file in *.tar.gz
do tar xzf "$file" -C /usr/local/bin
rm $file
done
- name: Build book
env:
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
run: |-
mdbook-admonish install --css-dir src/theme
mdbook build
- name: Upload book
uses: actions/upload-artifact@v4
with:
name: book
path: book
deploy-prod:
name: Deploy production wiki
needs: build
if: github.ref_name == 'prod'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: gh-pages
- name: Prepare to fetch book
run: |-
mv nightly ..
rm -rf *
- name: Fetch book artifact
uses: actions/download-artifact@v4
with:
name: book
- name: Deploy
run: |-
mv ../nightly .
git add -A
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git commit -m "Deploy $GITHUB_SHA to gh-pages"
git push --force --set-upstream origin gh-pages
deploy-nightly:
name: Deploy nightly wiki
needs: build
if: github.ref_name == 'dev'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: gh-pages
- name: Prepare to fetch book
run: rm -rf nightly/*
- name: Fetch book artifact
uses: actions/download-artifact@v4
with:
name: book
path: nightly
- name: Deploy
run: |-
git add -A
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git commit -m "Deploy nightly $GITHUB_SHA to gh-pages"
git push --force --set-upstream origin gh-pages
notify-discord:
name: Send notification
needs: [deploy-prod, deploy-nightly]
if: ${{ !failure() }}
runs-on: ubuntu-latest
env:
TYPE: Nightly
LINK: nightly
steps:
- name: Prepare notification
env:
RAW: ${{ github.event.head_commit.message }}
run: |-
echo "MESSAGE<<EOF" >> $GITHUB_ENV
RAW=$(echo "$RAW" | sed -r '/^\s*$/d')
echo "$RAW" | head -n 10 | sed ':a;N;$!ba;s/\n/\n /g' >> $GITHUB_ENV
if [ $(echo "$RAW" | wc -l) -gt 10 ]; then
echo " ..." >> $GITHUB_ENV
fi
echo "EOF" >> $GITHUB_ENV
- name: Set notification type
if: github.ref_name == 'prod'
run: |-
echo "TYPE=Production" >> $GITHUB_ENV
echo "LINK=" >> $GITHUB_ENV
- name: Send notification
uses: MineBartekSA/discord-webhook@v2.1
with:
webhook: ${{ secrets.WEBHOOK }}
embed: |-
title: "${{ env.TYPE }} Wiki Update"
color: 10001644
author:
name: ${{ github.event.head_commit.author.username }}
url: https://github.com/${{ github.event.head_commit.author.username }}
icon_url: https://github.com/${{ github.event.head_commit.author.username }}.png
thumbnail:
url: https://botdesignerdiscord.com/logo512.png
description: |-
**__Content__**
${{ env.MESSAGE }}
component: |-
- type: 2
style: 5
label: View commit
url: ${{ github.event.head_commit.url }}
- type: 2
style: 5
label: Preview site
url: https://nilpointer-software.github.io/bdfd-wiki/${{ env.LINK }}