building docs #224
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v35 | |
- name: find updated providers | |
id: provider-to-deploy | |
uses: actions/github-script@v6 | |
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/checkout@v2 | |
- 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 digitalocean firebase github google googleadmin k8s linode netlify okta sumologic vercel godaddy ) | |
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 |