@box/box-swift-sdk-gen 0.5.0 release note #1542
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
# This workflow listens to new pushes to | |
# the main and staging branches, as well as | |
# pull requests to those branches. | |
# | |
# It then runs all our linters on this content | |
# and then applies to `automerge` label for any pull | |
# request created by `box-devrel` with the `allow-automerge` | |
# label. | |
name: Lint & Build | |
on: | |
push: | |
branches: | |
- main | |
- staging | |
pull_request: | |
branches: | |
- main | |
- staging | |
jobs: | |
# Lint the content and trigger an auto merge on a pull request | |
lint: | |
runs-on: ubuntu-latest | |
timeout-minutes: 3 | |
strategy: | |
matrix: | |
node-version: [14.x] | |
steps: | |
# Check out the current branch | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
# Set up Node JS | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
# Determine the content repo to pull from | |
- uses: haya14busa/action-cond@v1 | |
id: content_repo | |
with: | |
cond: ${{ github.ref == 'refs/heads/staging' }} | |
if_true: "https://github.com/box/developer.box.com.git#en-staging" | |
if_false: "https://github.com/box/developer.box.com.git#en" | |
# Perform a lint of the content | |
- name: Lint the content | |
# Pull in the guides from the `en` branch for link validation | |
env: | |
CONTENT_REPO: ${{ steps.content_repo.outputs.value }} | |
# Install the dependencies and run the linter | |
run: | | |
yarn install | |
yarn lint | |
# If this is a PR by `box-devrel`, then apply the | |
# `automerge` label after linting passes. | |
- name: Apply the automerge label if needed | |
uses: christianvuerings/add-labels@v1 | |
if: | |
${{ github.event_name == 'pull_request' && github.actor == | |
'box-devrel' }} | |
with: | |
labels: automerge | |
# Use a personal access token from box-devrel | |
# This allows for other workflows to be triggered by this label being added | |
env: | |
GITHUB_TOKEN: ${{ secrets.DISPATCH_ACCESS_TOKEN }} | |
# Split the payload ref so we can parse the branch name | |
- uses: jungwinter/split@v1 | |
id: split | |
with: | |
msg: ${{ github.ref }} | |
seperator: "/" | |
# Finally, send a slack notification to the team to warn them of the new changes. | |
- name: Send Slack notification | |
uses: Ilshidur/[email protected] | |
if: ${{ github.ref == 'refs/heads/master' }} | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_USERNAME: GitHub Actions | |
SLACK_AVATAR: "https://avatars3.githubusercontent.com/u/8659759?s=200&v=4" | |
with: | |
args: "Developer Changelog: linting and testing" | |
# Deploy any new changes from the `main` / `staging` branches to the | |
# `en` and `en-staging` branches. | |
deploy: | |
runs-on: ubuntu-latest | |
timeout-minutes: 3 | |
# Being extra explicit, we only want this to run on the main and staging branches. | |
if: (github.ref == 'refs/heads/main') || github.ref == 'refs/heads/staging' | |
strategy: | |
matrix: | |
node-version: [14.x] | |
# Requires the lint job to pass first | |
needs: | |
- lint | |
steps: | |
# Check out the current branch | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
# Compile the content to the build folder | |
- name: Compile the content | |
run: | | |
yarn install | |
yarn build | |
# Determine the name of the branch to deploy to | |
- uses: haya14busa/action-cond@v1 | |
id: branch | |
with: | |
cond: ${{ github.ref == 'refs/heads/main' }} | |
if_true: "en" | |
if_false: "en-staging" | |
# Push the new build to the correct branch | |
- name: Push compiled content | |
uses: s0/[email protected] | |
env: | |
REPO: self | |
BRANCH: ${{ steps.branch.outputs.value }} | |
FOLDER: compiled | |
GITHUB_TOKEN: ${{ secrets.DISPATCH_ACCESS_TOKEN }} | |
# Send a slack notification to notify our team that a new release has been | |
# received. | |
- 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: | |
"Developer Changelog: Pushed latest markdown to `${{ | |
steps.branch.outputs.value }}` branch :rocket:" |