-
Notifications
You must be signed in to change notification settings - Fork 2
92 lines (77 loc) · 2.95 KB
/
docs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
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