-
Notifications
You must be signed in to change notification settings - Fork 3
72 lines (62 loc) · 2.19 KB
/
deploy.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
name: Build
on:
push:
branches:
- main
pull_request: {}
schedule:
- cron: "1 0 * * FRI" # every FRI at 00:01
workflow_dispatch: {} # manual release
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Begin CI...
uses: actions/checkout@v4
- name: Use Node 18
uses: actions/setup-node@v4
with:
node-version: 18.x
- name: Use cached node_modules
uses: actions/cache@v4
with:
path: node_modules
key: nodeModules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
nodeModules-
- name: Set Branch Name
id: branch_name
uses: nelonoel/branch-name@v1.0.1
- name: Setup Deployment Condition
id: deploy_setup
run: |
if [ "${{ env.BRANCH_NAME }}" == "main" ]; then
echo "DEPLOY_TO_PROD=true" >> $GITHUB_ENV
else
echo "DEPLOY_TO_PROD=false" >> $GITHUB_ENV
echo "DEPLOY_ALIAS=${{ env.BRANCH_NAME }}" >> $GITHUB_ENV
fi
- name: Publish site to Netlify
uses: jsmrcaga/action-netlify-deploy@v2.1.0
with:
NETLIFY_DEPLOY_TO_PROD: ${{ env.DEPLOY_TO_PROD }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_DEPLOY_MESSAGE: "Deployment from GitHub Actions ${{ steps.vars.outputs.sha_short }} (${{ steps.vars.outputs.branch }})"
deploy_alias: ${{ env.DEPLOY_ALIAS }}
build_directory: dist
- name: Publish new Orama Index
run: |
curl https://api.oramasearch.com/api/v1/indexes/queue-deployment \
-H 'content-type: application/json' \
-d '{"indexId":"juevpr4vk3mdx6g8be3i20t8"}' \
-H "Authorization: Bearer ${{ secrets.ORAMA_PRIVATE_API_KEY}}"
# Creates a status check with link to preview
- name: Get Netlify Status / Preview URL
if: ${{ env.DEPLOY_TO_PROD != 'true' }}
uses: Sibz/github-status-action@v1.1.1
with:
authToken: ${{ secrets.GITHUB_TOKEN }}
context: Netlify preview
state: success
target_url: ${{ env.NETLIFY_PREVIEW_URL }}