-
-
Notifications
You must be signed in to change notification settings - Fork 257
97 lines (93 loc) · 2.98 KB
/
_netlify.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
93
94
95
96
97
name: Netlify Deployments
on:
workflow_call:
inputs:
service:
description: 'The service/app to deploy'
type: string
required: true
target-env:
description: 'The target environment (staging/production)'
type: string
required: true
is_forked:
description: 'That PR is a fork (or not)'
type: string
required: false
default: 'false'
bypass_diff_check:
description: 'Bypass the monorepo diff check'
required: false
type: string
secrets:
# all netlify deployments
SITE_ID:
required: true
AUTH_TOKEN:
required: true
# unlock-app only
NEXT_PUBLIC_BASE64_WEDLOCKS_PUBLIC_KEY:
required: false
NEXT_PUBLIC_STRIPE_KEY:
required: false
NEXT_PUBLIC_ETHPASS_KEY:
required: false
NEXT_PUBLIC_UNLOCK_GA_ID:
required: false
NEXT_PUBLIC_UNLOCK_APP_URI:
required: false
# wedlocks only
SMTP_HOST:
required: false
SMTP_USERNAME:
required: false
SMTP_PASSWORD:
required: false
BASE64_WEDLOCKS_PRIVATE_KEY:
required: false
jobs:
check-changes:
runs-on: ubuntu-24.04
outputs:
changed: ${{ steps.check_changes.outputs.changed }}
steps:
- name: 'Free up disk space'
run: sudo rm -rf /usr/share/dotnet && sudo rm -rf /opt/ghc && sudo rm -rf "/usr/local/share/boost" && sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for changes in ${{ inputs.service }}
run: |
if [ -z "${{ inputs.bypass_diff_check }}" ]; then
changed=$(scripts/monorepo.sh ${{ inputs.service }} ${{ github.ref_name }})
else
changed="changed"
fi
echo $changed
echo "::set-output name=changed::$changed"
shell: bash
id: check_changes
deploy-netlify:
if: ${{ needs.check-changes.outputs.changed == 'changed' }}
name: Deploy ${{ inputs.service }} on Netlify ${{ inputs.target-env }}
runs-on: ubuntu-24.04
needs: check-changes
env:
DOCKER_BUILDKIT: 1
BUILDKIT_PROGRESS: plain
steps:
- uses: actions/checkout@v4
- name: 'Export secrets to env'
id: filter_secrets
run: |
SERVICE_NAME="${{ inputs.service }}"
UPCASE_SERVICE="${SERVICE_NAME^^}"
PREFIX="${UPCASE_SERVICE//-/_}_NETLIFY_${{ inputs.target-env }}"
PREFIX="${PREFIX^^}" # uppercase
bash .github/actions/secrets_to_env.sh '${{ toJson(secrets) }}' $PREFIX
- name: Deploy to Netlify
run: |
# show args
echo "${{ inputs.target-env }} ${{ inputs.service }} netlify $GITHUB_SHA $GITHUB_REF_NAME ${{ inputs.is_forked }}"
# run command
scripts/deploy.sh ${{ inputs.target-env }} ${{ inputs.service }} netlify "$GITHUB_SHA" "$GITHUB_REF_NAME" ${{ inputs.is_forked }}