-
Notifications
You must be signed in to change notification settings - Fork 1
113 lines (100 loc) · 3.77 KB
/
build-docs.yaml
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: build-docs-actions
run-name: building docs
on:
push:
branches:
- main
jobs:
find-provider-on-change:
runs-on: ubuntu-latest
outputs:
providers: ${{ steps.provider-to-deploy.outputs.provider_to_deploy }}
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/[email protected]
- name: find updated providers
id: provider-to-deploy
uses: actions/[email protected]
env:
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
with:
script: |
const script = require('./ci-scripts/get-providers-to-deploy.js')
await script({github, context, core})
- name: show updated providers
env:
PROVIDERS_TO_DEPLOY: ${{ steps.provider-to-deploy.outputs.provider_to_deploy }}
run: |
echo "found updated providers -> ${PROVIDERS_TO_DEPLOY}"
echo "PROVIDERS_TO_DEPLOY=${PROVIDERS_TO_DEPLOY}" >> $GITHUB_ENV
- name: prepare Slack message
env:
PROVIDERS_TO_DEPLOY: ${{ env.PROVIDERS_TO_DEPLOY }}
run: |
node ci-scripts/format-slack-message-payload.js "Provider doc builds starting for *${PROVIDERS_TO_DEPLOY}*" ":page_with_curl:"
- name: Send Slack message
id: slack
uses: slackapi/[email protected]
with:
payload-file-path: slack-message.json
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
deploy-to-netlify:
runs-on: ubuntu-latest
needs: find-provider-on-change
strategy:
fail-fast: false
matrix:
provider: ${{fromJson(needs.find-provider-on-change.outputs.providers)}}
steps:
- name: Checkout
uses: actions/[email protected]
- name: install
run:
npm install
- name: Build
env:
NODE_OPTIONS: "--max_old_space_size=24576"
run: npm run build:${{matrix.provider}}
- name: add redirects to root site
env:
PROVIDER: ${{ matrix.provider }}
run: |
if [ $PROVIDER == "root" ]; then
echo "adding vanity url redirects to _redirects file.."
touch ./build/_redirects
array=( aws azure azure-extras azure-isv azure-stack digitalocean firebase confluent github openai anthropic google googleadmin k8s linode netlify okta sumologic vercel godaddy pagerduty homebrew datadog )
for i in "${array[@]}"
do
echo "adding redirects for $i"
echo "/${i} https://${i}.stackql.io/providers/${i}/ 302" >> ./build/_redirects
echo "/providers/${i} https://${i}.stackql.io/providers/${i}/ 302" >> ./build/_redirects
done
else
echo "skipping redirects for ${PROVIDER}"
fi
- name: Publish
uses: netlify/actions/cli@master
env:
NETLIFY_SITE_ID: ${{ secrets[format('NETLIFY_SITE_ID_{0}', matrix.provider)] }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
with:
args: deploy --prod --dir ./build --message "Deploy from Github Action"
- name: prepare Slack message
env:
PROVIDER: ${{ matrix.provider }}
run: |
node ci-scripts/format-slack-message-payload.js "Deployment finished for *${PROVIDER}*" ":rocket:"
- name: Send Slack message
id: slack
uses: slackapi/[email protected]
with:
payload-file-path: slack-message.json
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK