Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Commit

Permalink
DX-3099 Update actions/checkout and actions/setup-node (#918)
Browse files Browse the repository at this point in the history
Upgrade `actions/checkout` and `actions/setup-node` to target `v3`
  • Loading branch information
ajrice6713 authored Jan 24, 2023
1 parent dc10eb9 commit 87805ed
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 77 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/cypress-prod-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Cypress Nightly on Prod

on:
schedule:
- cron: '0 4 * * *'
- cron: "0 4 * * *"

jobs:
cypress_nightly:
Expand All @@ -18,12 +18,12 @@ jobs:
browser: [chrome]
steps:
- name: Setup Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 16

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Cypress run
uses: cypress-io/[email protected]
Expand Down Expand Up @@ -51,4 +51,4 @@ jobs:
with:
job-status: failure
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
slack-channel: ${{ secrets.SLACK_CHANNEL }}
slack-channel: ${{ secrets.SLACK_CHANNEL }}
6 changes: 3 additions & 3 deletions .github/workflows/listener.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
if: ${{ github.event.action == 'Open' || github.event.action == 'Update' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Pass branch name to env
run: |
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
if: ${{ github.event.action == 'Close' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

# Close the cooresponding PR
# - run: |
Expand Down Expand Up @@ -136,7 +136,7 @@ jobs:
if: ${{ github.event.action == 'Draft' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Check and Update Draft Status
run: |
Expand Down
38 changes: 19 additions & 19 deletions .github/workflows/pr-closed-delete-staging-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ on:
pull_request:
types: [closed]
branches:
- 'main'
- "main"
paths:
- 'site/**'
- "site/**"

jobs:
cypress_cloudfront:
Expand All @@ -22,12 +22,12 @@ jobs:
browser: [chrome]
steps:
- name: Setup Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 16

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
Expand All @@ -41,7 +41,7 @@ jobs:
BRANCH_NAME=${GITHUB_HEAD_REF#refs/heads/}
BRANCH_NAME=$(echo "$BRANCH_NAME" | tr '[:upper:]' '[:lower:]')
BRANCH_NAME=$(echo "$BRANCH_NAME" | sed -e "s/[^a-z0-9]/-/g")
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
- name: Create Cypress Config
run: |
Expand Down Expand Up @@ -89,22 +89,22 @@ jobs:
needs: [cypress_cloudfront]
runs-on: ubuntu-latest
steps:
- name: Set Environment Variables
run: |
BRANCH_NAME=${GITHUB_HEAD_REF#refs/heads/}
BRANCH_NAME=$(echo "$BRANCH_NAME" | tr '[:upper:]' '[:lower:]')
BRANCH_NAME=$(echo "$BRANCH_NAME" | sed -e "s/[^a-z0-9]/-/g")
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
- name: Set Environment Variables
run: |
BRANCH_NAME=${GITHUB_HEAD_REF#refs/heads/}
BRANCH_NAME=$(echo "$BRANCH_NAME" | tr '[:upper:]' '[:lower:]')
BRANCH_NAME=$(echo "$BRANCH_NAME" | sed -e "s/[^a-z0-9]/-/g")
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Cleanup S3 Bucket
run: aws s3 rm s3://staging-dev-docsite/ --recursive --exclude "*" --include "${{ env.BRANCH_NAME }}/*"
- name: Cleanup S3 Bucket
run: aws s3 rm s3://staging-dev-docsite/ --recursive --exclude "*" --include "${{ env.BRANCH_NAME }}/*"

notify_for_failures:
name: Notify for Failures
Expand Down
25 changes: 12 additions & 13 deletions .github/workflows/pr-publish-docsite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: PR Publish Docsite
on:
pull_request:
branches:
- 'main'
- "main"
paths:
- 'site/**'
- "site/**"
workflow_dispatch:

concurrency:
Expand All @@ -28,12 +28,12 @@ jobs:
browser: [chrome]
steps:
- name: Setup Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 16

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Cypress run
uses: cypress-io/[email protected]
Expand Down Expand Up @@ -64,10 +64,10 @@ jobs:
id: ${{steps.distribution.outputs.distribution-id}}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 16

Expand All @@ -87,15 +87,15 @@ jobs:

- name: Generate Static Site
run: |
cd site
yarn install --pure-lockfile
npm run build
cd site
yarn install --pure-lockfile
npm run build
- name: Sync Zip to Bucket
run: |
aws s3 sync ./site/build s3://staging-dev-docsite/$BRANCH_NAME --acl public-read
aws s3 sync ./site/build s3://staging-dev-docsite/$BRANCH_NAME --acl public-read
- name: Invalidate CF Cache
- name: Invalidate CF Cache
run: |
aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID}} --paths "/" "/*"
Expand All @@ -111,15 +111,14 @@ jobs:
body: 'http://${{ env.BRANCH_NAME }}.staging-dev.bandwidth.com/'
})
alert_if_failure:
name: Alert for failure
needs: [cypress, publish]
if: failure() && !github.event.pull_request.draft
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Get Branch Name
run: |
Expand Down
50 changes: 23 additions & 27 deletions .github/workflows/publish-docsite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
types:
- published
workflow_dispatch:


jobs:
cypress:
Expand All @@ -23,12 +22,12 @@ jobs:
browser: [chrome]
steps:
- name: Setup Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 16

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Cypress run
uses: cypress-io/[email protected]
Expand All @@ -55,10 +54,10 @@ jobs:
if: ${{ !github.event.release.prerelease && github.event.release.target_commitish == 'main' }}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 16

Expand All @@ -84,22 +83,19 @@ jobs:
- name: Invalidate Cloudfront Cache
id: invalidate1
continue-on-error: true
run:
aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID}} --paths "/" "/*"
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID}} --paths "/" "/*"

- name: Invalidate Cloudfront Cache Attempt 2
id: invalidate2
if: steps.invalidate1.outcome=='failure'
continue-on-error: true
run:
aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID}} --paths "/" "/*"
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID}} --paths "/" "/*"

- name: Invalidate Cloudfront Cache Attempt 3
continue-on-error: true
id: invalidate3
if: steps.invalidate2.outcome=='failure'
run:
aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID}} --paths "/" "/*"
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID}} --paths "/" "/*"

- name: Cloudfront Cache Invalidation Status
if: always()
Expand All @@ -108,7 +104,7 @@ jobs:
echo invalidation successful
else
exit 1
fi
fi
cypress_post_tests:
name: Cypress run on prod
Expand All @@ -129,7 +125,7 @@ jobs:
node-version: 16

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Cypress Post Deployment Test
uses: cypress-io/[email protected]
Expand All @@ -146,7 +142,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_INFO_MESSAGE: ${{github.event.pull_request.title}}
COMMIT_INFO_SHA: ${{github.event.pull_request.head.sha}}

notify_for_failures:
name: Notify for Failures
needs: [cypress_post_tests]
Expand All @@ -158,27 +154,27 @@ jobs:
with:
job-status: failure
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
slack-channel: ${{ secrets.SLACK_CHANNEL }}
slack-channel: ${{ secrets.SLACK_CHANNEL }}

rollback_if_failed:
needs: [cypress, publish, cypress_post_tests]
name: Rollback Release
if: ${{ failure() && github.event_name != 'workflow_dispatch' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16

- name: Install Dependencies
run: |
- name: Install Dependencies
run: |
cd ./.github/actions/rollback_release
npm install
- name: Rollback For Failed Cypress Tests
id: rollback
uses: ./.github/actions/rollback_release
env:
GITHUB_TOKEN: ${{ secrets.DX_GITHUB_TOKEN }}
- name: Rollback For Failed Cypress Tests
id: rollback
uses: ./.github/actions/rollback_release
env:
GITHUB_TOKEN: ${{ secrets.DX_GITHUB_TOKEN }}
22 changes: 11 additions & 11 deletions .github/workflows/rollback-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ jobs:
name: Rollback Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16

- name: Install Dependencies
run: |
- name: Install Dependencies
run: |
cd ./.github/actions/rollback_release
npm install
- name: Update the Bad Release to a Draft
uses: ./.github/actions/rollback_release
env:
GITHUB_TOKEN: ${{ secrets.DX_GITHUB_TOKEN }}
- name: Update the Bad Release to a Draft
uses: ./.github/actions/rollback_release
env:
GITHUB_TOKEN: ${{ secrets.DX_GITHUB_TOKEN }}

0 comments on commit 87805ed

Please sign in to comment.