Files
gitea-docs/.gitea/workflows/build-and-publish.yaml
2023-05-16 09:43:08 +08:00

46 lines
1.3 KiB
YAML

name: Build and Publish Docs site
run-name: docusaurus build docs site
on:
push:
branches:
- main
jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: https://github.com/actions/setup-node@v3
with:
node-version: 16
- name: install necessary tools
run: |
apt update -y && apt install -y rsync python python3-pip
pip install awscli
- name: prepare nightly docs
run: |
make prepare-latest
#prepare-latest-zh-cn
- name: prepare 1.19 docs
run: |
make prepare\#19
#prepare-zh-cn\#19
- name: cleanup before build
run: |
rm static/_*
- name: build site
run: |
npm ci
npm run build
- name: aws credential configure
uses: https://github.com/aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
aws-region: ${{ secrets.AWS_REGION}}
- name: Copy files to the production website with the AWS CLI
run: |
aws s3 sync build/ s3://docs-gitea-com
aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_DISTRIBUTION}} --paths '/*'