Skip to content

Docs

Docs #150

Workflow file for this run

name: Docs
on:
workflow_run:
workflows: ["Publish"]
types: [completed]
jobs:
Docs:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout repositiory
uses: actions/checkout@v2
with:
fetch-depth: "0"
ref: "docs"
- name: Set Github credentials
run: |
git config user.name searchspring-machine
git config user.email [email protected]
- name: Merge main into docs branch
run: |
git merge -X theirs origin/main
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 20
- name: Configure Variables
run: |
echo "current_tag=$(node .github/workflows/scripts/getTag.js --tags "$(git tag -l)")" >> $GITHUB_ENV
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install packages
run: npm ci
- name: Build
run: |
npm run build
- name: Build Feed
run: |
npm run build:feed
- name: Build docs
run: |
npm run build:docs
git add docs/snap-docs.json
git add -A packages/snap-*/docs/
git commit -m "chore(docs): generation"
git push
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.SNAPFU_AWS_KEY_ID }}
aws-secret-access-key: ${{ secrets.SNAPFU_AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Copy Files to S3
run: |
aws s3 sync --acl public-read packages/snap-preact-demo/dist s3://${{ secrets.SNAPFU_AWS_BUCKET }}/snap/${{ env.current_tag }}
aws s3 sync --acl public-read packages/snap-preact-demo/public s3://${{ secrets.SNAPFU_AWS_BUCKET }}/snap/${{ env.current_tag }}
aws s3 sync --acl public-read packages/snap-preact-demo/dist s3://${{ secrets.SNAPFU_AWS_BUCKET }}/snap/production
aws s3 sync --acl public-read packages/snap-preact-demo/public s3://${{ secrets.SNAPFU_AWS_BUCKET }}/snap/production
- name: Invalidate CDN Files
env:
AWS_MAX_ATTEMPTS: 9
run: |
aws cloudfront create-invalidation --distribution-id ${{ secrets.SNAPFU_AWS_DISTRIBUTION_ID }} --paths "/snap/*"
- name: Request Re-index of Feed
run: |
sleep 3
curl -v -XPUT -u vrntn7:${{ secrets.DOCS_WEBSITE_SECRET_KEY }} https://index-api.searchspring.net/api/index/feed?feedId=4617