Update Authorization_Cheat_Sheet.md (#1564) #928
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and deploy offline website | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
name: Build offline website | |
runs-on: ubuntu-24.04 | |
env: | |
CI: true | |
WORKFLOW_GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }} | |
steps: | |
- name: Setup Action | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install Python dependencies | |
run: make install-python-requirements | |
- name: Run build script | |
run: cd scripts && bash Generate_Site_mkDocs.sh | |
- name: List generated files | |
run: ls -al generated/site/ | |
- name: Create bundle | |
run: cd generated && zip -r ../bundle.zip site | |
- name: Test bundle | |
run: zip -T bundle.zip | |
- name: Upload bundle as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Bundle | |
path: bundle.zip | |
deploy: | |
name: Deploy offline website | |
needs: build | |
runs-on: ubuntu-latest | |
env: | |
CI: true | |
steps: | |
- name: Setup Action | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # fetch all branches | |
- name: Install dependencies | |
run: sudo apt-get install -y unzip zip | |
- name: Switch to offline website (gh-pages) branch | |
run: git checkout gh-pages | |
- name: Remove previous version website files | |
run: | | |
shopt -s extglob | |
rm -rdfv !("CNAME"|"robots.txt"|"_config.yml") | |
- name: Download new build from artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: Bundle | |
- name: Display structure of downloaded files | |
run: ls -R | |
# - name: Replace bundle with new build | |
# run: | | |
# mv Bundle.zip bundle.zip | |
# rm -rf Bundle 1>/dev/null 2>&1 | |
- name: Test new bundle | |
run: zip -T bundle.zip | |
- name: Extract new bundle | |
run: | | |
unzip bundle.zip | |
mv site/* . | |
upd=`date +"%Y-%m-%d at %T"`; echo "Website last update: $upd." > README.md | |
rm -rf site | |
- name: Commit changes to gh-pages | |
run: | | |
git config --global user.email "action@github.com" | |
git config --global user.name "GitHub Action" | |
git add --all . | |
git commit -a -m "Deploy the generated website via GitHub Actions" | |
- name: Publish the build to gh-pages | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages | |
- name: Send update to Slack | |
uses: innocarpe/actions-slack@v1 | |
with: | |
status: ${{ job.status }} | |
success_text: 'Offline website deployment: **success**' | |
failure_text: 'Offline website deployment: **fail**' | |
cancelled_text: 'Offline website deployment **cancelled**' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} |