Merge branch 'DDOC-1226-publishing' of github.com:box/developer.box.c… #4371
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
# The name of this GH action | |
name: CI | |
# Defines when this action should be run | |
on: | |
# Run on any Push | |
push: | |
branches-ignore: | |
- en | |
- en-staging | |
- en-abtest | |
- en-snapshot | |
- jp | |
- jp-partial | |
- jp-staging | |
# Run for PRs on main and staging | |
pull_request: | |
branches: [main, staging, abtest, jp-staging] | |
jobs: | |
# The lint job checks that all content is sanitized, | |
# spell checked, and without any obvious dead links | |
lint: | |
# We run this on the latest ubuntu | |
runs-on: ubuntu-latest | |
timeout-minutes: 3 | |
# We use node 18.X | |
strategy: | |
matrix: | |
node-version: [18.x] | |
# The following steps are performed for each lint job | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- name: Lint the yaml files in ./content | |
uses: karancode/[email protected] | |
with: | |
yamllint_file_or_dir: ./content | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Lint the content | |
run: | | |
yarn install | |
yarn ci | |
# The test job ensures that the markdown and yaml compilers | |
# work according to specifiction | |
test: | |
# We run this on the latest ubuntu | |
runs-on: ubuntu-latest | |
timeout-minutes: 3 | |
# We use node 18.X | |
strategy: | |
matrix: | |
node-version: [18.x] | |
# The following steps are performed for each lint job | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Run the test | |
run: | | |
yarn install | |
yarn test | |
- name: Send Slack notification | |
uses: Ilshidur/[email protected] | |
if: github.ref == 'refs/heads/main' | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_USERNAME: GitHub Actions | |
SLACK_AVATAR: "https://avatars3.githubusercontent.com/u/8659759?s=200&v=4" | |
with: | |
args: "Markdown passed linting and testing" | |
# The deploy task actually deploys any changes to the en branch | |
push-to-en: | |
# We run this on the latest ubuntu | |
runs-on: ubuntu-latest | |
timeout-minutes: 3 | |
# Only run for the main branch | |
if: github.ref == 'refs/heads/main' | |
# We use node 18.X | |
strategy: | |
matrix: | |
node-version: [18.x] | |
# Requires the lint and test jobs to pass first | |
needs: | |
- lint | |
- test | |
# The following steps are performed for each lint job | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- name: Compile the content | |
run: | | |
yarn install | |
yarn build | |
- name: Push compiled content | |
uses: s0/[email protected] | |
env: | |
REPO: self | |
BRANCH: en | |
FOLDER: compiled | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Trigger Netlify deployment" | |
uses: joelwmale/[email protected] | |
env: | |
WEBHOOK_URL: ${{ secrets.NETLIFY_BOXDEV_WEBHOOK }} | |
data: "{}" | |
- name: "Trigger Netlify deployment (Box.dev mirror)" | |
uses: joelwmale/[email protected] | |
env: | |
WEBHOOK_URL: ${{ secrets.NETLIFY_BOXDEV_MIRROR_WEBHOOK }} | |
data: "{}" | |
- name: Send Slack notification | |
uses: Ilshidur/[email protected] | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_USERNAME: GitHub Actions | |
SLACK_AVATAR: "https://avatars3.githubusercontent.com/u/8659759?s=200&v=4" | |
with: | |
args: "Pushed latest Markdown to `en` branch :rocket:" | |
- name: Send Slack notification | |
uses: Ilshidur/[email protected] | |
if: ${{ failure() }} | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_USERNAME: GitHub Actions | |
SLACK_AVATAR: "https://avatars3.githubusercontent.com/u/8659759?s=200&v=4" | |
with: | |
args: "Error running `deploy` job in OpenAPI CI" | |
# The deploy task actually deploys any changes to the en-staging branch | |
push-to-en-staging: | |
# We run this on the latest ubuntu | |
runs-on: ubuntu-latest | |
# Only run for the staging branch | |
if: github.ref == 'refs/heads/staging' | |
# We use node 18.X | |
strategy: | |
matrix: | |
node-version: [18.x] | |
# Requires the lint and test jobs to pass first | |
needs: | |
- lint | |
- test | |
# The following steps are performed for each lint job | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- name: Compile the content | |
run: | | |
yarn install | |
yarn build | |
- name: Push compiled content | |
uses: s0/[email protected] | |
env: | |
REPO: self | |
BRANCH: en-staging | |
FOLDER: compiled | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Trigger Netlify deployment | |
uses: joelwmale/[email protected] | |
env: | |
WEBHOOK_URL: ${{ secrets.NETLIFY_BOXDEV_STAGING_WEBHOOK }} | |
data: "{}" | |
- name: Send Slack notification | |
uses: Ilshidur/[email protected] | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_USERNAME: GitHub Actions | |
SLACK_AVATAR: "https://avatars3.githubusercontent.com/u/8659759?s=200&v=4" | |
with: | |
args: "Pushed latest Markdown to `en-staging` branch :rocket:" | |
- name: Send Slack notification | |
uses: Ilshidur/[email protected] | |
if: ${{ failure() }} | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_USERNAME: GitHub Actions | |
SLACK_AVATAR: "https://avatars3.githubusercontent.com/u/8659759?s=200&v=4" | |
with: | |
args: "Error running `deploy-staging` job in OpenAPI CI" | |
# The deploy task actually deploys any changes to the en-staging branch | |
push-to-en-abtest: | |
# We run this on the latest ubuntu | |
runs-on: ubuntu-latest | |
# Only run for the staging branch | |
if: github.ref == 'refs/heads/abtest' | |
# We use node 18.X | |
strategy: | |
matrix: | |
node-version: [18.x] | |
# Requires the lint and test jobs to pass first | |
needs: | |
- lint | |
- test | |
# The following steps are performed for each lint job | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- name: Compile the content | |
run: | | |
yarn install | |
yarn build | |
- name: Push compiled content | |
uses: s0/[email protected] | |
env: | |
REPO: self | |
BRANCH: en-abtest | |
FOLDER: compiled | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Trigger Netlify deployment | |
uses: joelwmale/[email protected] | |
env: | |
WEBHOOK_URL: ${{ secrets.NETLIFY_BOXDEV_ABTEST_WEBHOOK }} | |
data: "{}" | |
- name: Send Slack notification | |
uses: Ilshidur/[email protected] | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_USERNAME: GitHub Actions | |
SLACK_AVATAR: "https://avatars3.githubusercontent.com/u/8659759?s=200&v=4" | |
with: | |
args: "Pushed latest Markdown to `abtest` branch :rocket:" | |
- name: Send Slack notification | |
uses: Ilshidur/[email protected] | |
if: ${{ failure() }} | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_USERNAME: GitHub Actions | |
SLACK_AVATAR: "https://avatars3.githubusercontent.com/u/8659759?s=200&v=4" | |
with: | |
args: "Error running `deploy-abtest` job in OpenAPI CI" | |
# The deploy task actually deploys any changes to the jp-staging branch | |
push-to-jp-staging: | |
# We run this on the latest ubuntu | |
runs-on: ubuntu-latest | |
# Only run for the staging branch | |
if: github.ref == 'refs/heads/jp-staging' | |
# We use node 14.X | |
strategy: | |
matrix: | |
node-version: [14.x] | |
# Requires the lint and test jobs to pass first | |
needs: | |
- lint | |
- test | |
# The following steps are performed for each lint job | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- name: Compile the content | |
run: | | |
yarn install | |
yarn build | |
- name: Push compiled content | |
uses: s0/[email protected] | |
env: | |
REPO: self | |
BRANCH: jp-staging | |
FOLDER: compiled | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Trigger Netlify deployment | |
uses: joelwmale/[email protected] | |
env: | |
WEBHOOK_URL: ${{ secrets.NETLIFY_BOXDEV_JP_STAGING_WEBHOOK }} | |
data: "{}" | |
- name: Send Slack notification | |
uses: Ilshidur/[email protected] | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_USERNAME: GitHub Actions | |
SLACK_AVATAR: "https://avatars3.githubusercontent.com/u/8659759?s=200&v=4" | |
with: | |
args: "Pushed latest Markdown to `jp-staging` branch :rocket:" | |
- name: Send Slack notification | |
uses: Ilshidur/[email protected] | |
if: ${{ failure() }} | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_USERNAME: GitHub Actions | |
SLACK_AVATAR: "https://avatars3.githubusercontent.com/u/8659759?s=200&v=4" | |
with: | |
args: "Error running `deploy-jp-staging` job in OpenAPI CI" |