Skip to content

Commit

Permalink
Add workflow for deploying to checkly
Browse files Browse the repository at this point in the history
  • Loading branch information
jameswburke committed Aug 8, 2024
1 parent 30bcb7a commit e888317
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/deploy-to-checkly-on-merges-to-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Deploy to Checkly on merges to main

on:
workflow_call:
secrets:
BITBUCKET_READ_ONLY_SSH_KEY:
required: false
GITHUB_READ_ONLY_SSH_KEY:
required: false
CHECKLY_API_KEY:
required: false
CHECKLY_ACCOUNT_ID:
required: false

permissions:
contents: read

# See https://www.checklyhq.com/docs/cli/command-line-reference/#npx-checkly-deploy and supporting documentation for
# more details on Checkly environment variables.
env:
CHECKLY_ACCOUNT_ID: ${{ secrets.CHECKLY_ACCOUNT_ID }}
CHECKLY_API_KEY: ${{ secrets.CHECKLY_API_KEY }}
CHECKLY_REPO_BRANCH: ${{ github.head_ref }}
CHECKLY_REPO_COMMIT_OWNER: ${{ github.actor }}
CHECKLY_REPO_SHA: ${{ github.sha }}
CHECKLY_TEST_ENVIRONMENT: ${{ inputs.QA_SITE_DOMAIN }}
FEATURE_BRANCH_NAME: $(echo "${{ github.head_ref || github.ref_name }}" | sed -e 's/feature\/\(.*\)/\1/' | tr '[:upper:]' '[:lower:]')
NPM_QAT_SCRIPT: "qat"

jobs:
checkly-deploy:
name: Checkly Run and Deploy
runs-on: ubuntu-latest
timeout-minutes: 90
# if the check_files step in the check-qat job doesn't fail

concurrency:
group: ${{ github.ref_name || github.run_id }}-checkly-qat
cancel-in-progress: true

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Check out the full git history

- uses: actions/setup-node@v3
with:
node-version: 20 # Checkly CLI requires Node.js 16 or higher.

- name: Restore or cache node_modules # Restore node_modules cache if available
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}

- name: Install dependencies # Install NPM dependencies if cache miss
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci

- name: Deploy checks # Deploy checks to Checkly for debugging
# Only run if the pull request is merging into the main branch
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
id: deploy-checks
run: npm run qat:checkly:deploy -- --force

0 comments on commit e888317

Please sign in to comment.