rollback device pinners #2145
Workflow file for this run
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-snapshot | |
- jp | |
- jp-partial | |
# Run for PRs on main and staging | |
pull_request: | |
branches: [main, 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: 10 | |
# We use node 14 and Python 3.8 | |
strategy: | |
matrix: | |
node-version: [14.x] | |
python-version: [3.8] | |
# The following steps are performed for each lint job | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install yamllint | |
- name: Set up Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install Node dependencies | |
run: | | |
yarn install | |
- name: Lint the content | |
run: | | |
yarn lint | |
# Verify compiled schema is up to date | |
# If this action fails, it means one have to run `yarn build:schema` and commit changes in the file | |
verify-compiled-schema-up-to-date: | |
name: Verify openapi.json file is up to date | |
# We run this on the latest ubuntu | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging' || github.event_name == 'pull_request' | |
timeout-minutes: 10 | |
# We use node 14.X | |
strategy: | |
matrix: | |
node-version: [14.x] | |
# The following steps are performed for each job | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Set up Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Compile the content | |
run: | | |
yarn install | |
yarn build:schema | |
- name: Verify openapi.json file is up to date (run 'yarn build:schema' and commit changes in openapi.json file if this command returns error) | |
run: git diff --quiet openapi.json | |
# 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 | |
if: github.ref == 'refs/heads/main' | |
timeout-minutes: 10 | |
# We use node 14.X | |
strategy: | |
matrix: | |
node-version: [14.x] | |
# Requires the lint and test jobs to pass first | |
needs: | |
- lint | |
# The following steps are performed for each job | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Set up Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Compile the content | |
run: | | |
yarn install | |
yarn build:content | |
yarn build:swagger | |
- name: Push compiled content | |
uses: s0/git-publish-subdir-action@v2.4.0 | |
env: | |
REPO: self | |
BRANCH: en | |
FOLDER: compiled/content | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push GH pages for redundancy | |
uses: s0/git-publish-subdir-action@v2.4.0 | |
env: | |
REPO: self | |
BRANCH: gh-pages | |
FOLDER: compiled/content | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push Swagger 2.0 backport | |
uses: s0/git-publish-subdir-action@v2.4.0 | |
env: | |
REPO: self | |
BRANCH: swagger-2.0 | |
FOLDER: compiled/swagger | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Notify other repositories of update | |
uses: peter-evans/repository-dispatch@v1 | |
with: | |
token: ${{ secrets.REPO_ACCESS_TOKEN }} | |
repository: box/box-postman | |
event-type: openapi-update | |
client-payload: "{}" | |
- name: "Trigger Netlify deployment" | |
uses: joelwmale/webhook-action@2.0.2 | |
env: | |
WEBHOOK_URL: ${{ secrets.NETLIFY_BOXDEV_WEBHOOK }} | |
data: "{}" | |
- name: "Trigger Netlify deployment (Box.dev mirror)" | |
uses: joelwmale/webhook-action@2.0.2 | |
env: | |
WEBHOOK_URL: ${{ secrets.NETLIFY_BOXDEV_MIRROR_WEBHOOK }} | |
data: "{}" | |
- name: Send Slack notification | |
uses: Ilshidur/action-slack@2.0.2 | |
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 OpenAPI changes to `en` branch :rocket:" | |
- name: Send Slack notification | |
uses: Ilshidur/action-slack@2.0.2 | |
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 | |
if: github.ref == 'refs/heads/staging' | |
timeout-minutes: 10 | |
# We use node 14.X | |
strategy: | |
matrix: | |
node-version: [14.x] | |
# Requires the lint and test jobs to pass first | |
needs: | |
- lint | |
# The following steps are performed for each job | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Set up Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Compile the content | |
run: | | |
yarn install | |
yarn build:content | |
- name: Push compiled content | |
uses: s0/git-publish-subdir-action@v2.4.0 | |
env: | |
REPO: self | |
BRANCH: en-staging | |
FOLDER: compiled/content | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Trigger Netlify deployment" | |
uses: joelwmale/webhook-action@2.0.2 | |
env: | |
WEBHOOK_URL: ${{ secrets.NETLIFY_BOXDEV_STAGING_WEBHOOK }} | |
data: "{}" | |
- name: Send Slack notification | |
uses: Ilshidur/action-slack@2.0.2 | |
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 OpenAPI changes to `en-staging` branch :rocket:" | |
- name: Send Slack notification | |
uses: Ilshidur/action-slack@2.0.2 | |
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" | |
# Build the OpenAPI spec and validate using Codegen | |
validate-spec: | |
name: Validate OpenAPI spec using Codegen | |
# We run this on the latest ubuntu | |
runs-on: ubuntu-latest | |
# The following steps are performed for each job | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
with: | |
path: box-openapi | |
- name: Set up Node.js 16.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
- name: Compile the content | |
run: | | |
cd $GITHUB_WORKSPACE/box-openapi | |
yarn install | |
yarn build:content | |
- name: Check out the Codegen repo | |
uses: actions/checkout@v3 | |
with: | |
repository: box/box-codegen | |
ref: main | |
token: ${{ secrets.CODEGEN_REPO_ACCESS_TOKEN }} | |
path: box-codegen | |
- name: Run Codegen spec validation | |
run: | | |
cd $GITHUB_WORKSPACE/box-codegen | |
npm install | |
cd scripts | |
npm install | |
cp $GITHUB_WORKSPACE/box-openapi/compiled/content/openapi.json . | |
npm run validate ./openapi.json |