-
Notifications
You must be signed in to change notification settings - Fork 116
60 lines (55 loc) · 2.96 KB
/
deploy_website.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
name: Website Deploy
on:
push:
branches: [master]
pull_request:
branches: [master]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/master' || github.run_number }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
publish-website:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: lts/hydrogen
- run: npm ci
- run: npm run build
- run: npm ci
working-directory: website
- run: npm run build
working-directory: website
env:
NODE_OPTIONS: "--max_old_space_size=4096"
ALGOLIA_APPLICATION_ID: ${{ github.ref != 'refs/heads/master' && 'example' || secrets.ALGOLIA_APPLICATION_ID }}
ALGOLIA_SEARCH_API_KEY: ${{ github.ref != 'refs/heads/master' && 'example' || secrets.ALGOLIA_SEARCH_API_KEY }}
ALGOLIA_UPDATE_API_KEY: ${{ github.ref != 'refs/heads/master' && 'example' || secrets.ALGOLIA_UPDATE_API_KEY }}
FIREBASE_AUTH_DOMAIN: ${{ github.ref != 'refs/heads/master' && secrets.FIREBASE_AUTH_DOMAIN || secrets.FIREBASE_AUTH_DOMAIN_PROD }}
FIREBASE_API_KEY: ${{ github.ref != 'refs/heads/master' && secrets.FIREBASE_API_KEY || secrets.FIREBASE_API_KEY_PROD }}
FIREBASE_PROJECT_ID: ${{ github.ref != 'refs/heads/master' && secrets.FIREBASE_PROJECT_ID || secrets.FIREBASE_PROJECT_ID_PROD }}
FIREBASE_STORAGE_BUCKET: ${{ github.ref != 'refs/heads/master' && secrets.FIREBASE_STORAGE_BUCKET || secrets.FIREBASE_STORAGE_BUCKET_PROD }}
FIREBASE_MESSAGING_SENDER_ID: ${{ github.ref != 'refs/heads/master' && secrets.FIREBASE_MESSAGING_SENDER_ID || secrets.FIREBASE_MESSAGING_SENDER_ID_PROD }}
FIREBASE_APP_ID: ${{ github.ref != 'refs/heads/master' && secrets.FIREBASE_APP_ID || secrets.FIREBASE_APP_ID_PROD }}
FIREBASE_MEASUREMENT_ID: ${{ github.ref != 'refs/heads/master' && secrets.FIREBASE_MEASUREMENT_ID || secrets.FIREBASE_MEASUREMENT_ID_PROD }}
- run: npm run build-docs
- run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- run: npm run netlify:${{ github.ref != 'refs/heads/master' && 'preview' || 'publish' }}
working-directory: website
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
- name: Update Algolia Index
if: github.ref == 'refs/heads/master'
run: |
docker run --rm -e "CONFIG=$(cat ./website/config.json | jq -r tostring)" \
-e API_KEY=${{secrets.ALGOLIA_UPDATE_API_KEY}} \
-e APPLICATION_ID=${{secrets.ALGOLIA_APPLICATION_ID}} \
algolia/docsearch-scraper
# Notify the PR of the deploy preview
- uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
with:
header: netlify-preview
message: 'A new deploy preview is available on Netlify at https://${{ env.short_sha }}--tezostaquito.netlify.app'