Bump to 1.10 #37
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 Site | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- 'help/**' | |
- '**/build-site.yml' | |
pull_request: | |
branches: | |
- master | |
paths: | |
- 'help/**' | |
- '**/build-site.yml' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./help | |
strategy: | |
matrix: | |
python-version: [3.10.9] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install mkdocs | |
pip install mkdocs-material | |
pip install mkdocs-git-revision-date-localized-plugin | |
pip install pillow | |
pip install cairosvg | |
sudo apt-get install -y libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev | |
- name: Install and modify Pygments | |
run: | | |
git clone https://github.com/pygments/pygments.git | |
# Replace with Razor files | |
rm ./pygments/pygments/lexers/_mapping.py | |
cp pygments.mapping.razor ./pygments/pygments/lexers/_mapping.py | |
cp pygments.lexers.razor ./pygments/pygments/lexers/razor.py | |
cp pygments.styles.razor ./pygments/pygments/styles/razor.py | |
pip install -e ./pygments/ | |
# Runs a single command using the runners shell | |
- name: Build site | |
run: mkdocs build | |
- name: Generate robots.txt | |
run: | | |
cat > ./site/robots.txt <<EOF | |
User-agent: * | |
Allow: / | |
Sitemap: https://www.razorce.com/sitemap.xml | |
EOF | |
# Setup AWS | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }} | |
aws-region: us-east-1 | |
- name: Deploy static site to S3 bucket | |
run: aws s3 sync ./site s3://www.razorce.com | |
# Invalidate the distributons | |
- name: Create CloudFront Invalidation | |
run: | | |
aws cloudfront create-invalidation --distribution-id ${{ secrets.DISTRIBUTION_A }} --paths "/*" | |
aws cloudfront create-invalidation --distribution-id ${{ secrets.DISTRIBUTION_B }} --paths "/*" |