-
Notifications
You must be signed in to change notification settings - Fork 115
64 lines (53 loc) · 1.69 KB
/
algolia-publish.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
name: Algolia Publish
on:
push:
branches:
- master
jobs:
algolia-push-records:
name: Push new records if changes
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Use Node
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: Install Dependencies
run: yarn
working-directory: ./website
- name: Build Packages
run: yarn build
working-directory: ./website
- name: Algolia push
run: yarn algolia-sync
working-directory: ./website
env:
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_ADMIN_API_KEY: ${{ secrets.ALGOLIA_ADMIN_API_KEY }}
ALGOLIA_INDEX_NAME: ${{ secrets.ALGOLIA_INDEX_NAME }}
SITE_URL: https://www.graphql-cli.com/
- name: Yarn build at root
run: yarn
- name: Prettier
run: yarn prettier -w website/algolia-lockfile.json
- name: Compare
run: git diff website/algolia-lockfile.json
- name: Diff to file
if: always()
id: diff_result
run: |
OUTPUT=$(git diff website/algolia-lockfile.json)
OUTPUT="${OUTPUT//'%'/'%25'}"
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
echo "::set-output name=result::$OUTPUT"
- name: Commit algolia-lockfile.json
if: always() && contains(steps.diff_result.outputs.result, 'diff')
uses: EndBug/add-and-commit@v9
with:
commit: website/algolia-lockfile.json
message: Update algolia-lockfile.json
default_author: github_actions