-
Notifications
You must be signed in to change notification settings - Fork 1
136 lines (121 loc) · 4.24 KB
/
build-docs.yaml
File metadata and controls
136 lines (121 loc) · 4.24 KB
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
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/checkout@v4.1.1
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44.3.0
- name: find updated providers
id: provider-to-deploy
uses: actions/github-script@v7.0.1
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/slack-github-action@v1.26.0
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: Show current matrix provider
run: >
echo "⚙️ Deploying docs for matrix provider: ${{ matrix.provider }}"
- name: Checkout
uses: actions/checkout@v4.1.1
- 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
confluent
github
openai
anthropic
k8s
sumologic
vercel
pagerduty
homebrew
)
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: stackql/actions/cli@replace-deprecated-set-output
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" --no-build
- name: Preparing and sending Slack message
run: >
echo "📣 Preparing and sending Slack message for matrix provider: ${{ matrix.provider }}"
- 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/slack-github-action@v1.26.0
with:
payload-file-path: slack-message.json
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK