Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

ci: introduce staging deployment actions

Liyas Thomas0d33758ba4dd
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index ab9c411a2..8f4524e27 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -1,72 +1,63 @@
-# For most projects, this workflow file will not need changing; you simply need
-# to commit it to your repository.
-#
-# You may wish to alter this file to override the set of languages analyzed,
-# or to provide custom queries or build logic.
-#
-# ******** NOTE ********
-# We have attempted to detect the languages in your repository. Please check
-# the `language` matrix defined below to confirm you have the correct set of
-# supported CodeQL languages.
-#
-name: "CodeQL"
+name: "CodeQL analysis"
on:
push:
- branches: [ main ]
+ branches: [main]
pull_request:
- # The branches below must be a subset of the branches above
- branches: [ main ]
+ branches: [main]
schedule:
- - cron: '39 7 * * 2'
+ # ┌───────────── minute (0 - 59)
+ # │ ┌───────────── hour (0 - 23)
+ # │ │ ┌───────────── day of the month (1 - 31)
+ # │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
+ # │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
+ # │ │ │ │ │
+ # │ │ │ │ │
+ # │ │ │ │ │
+ # * * * * *
+ - cron: '30 1 * * 0'
jobs:
analyze:
name: Analyze
+ # CodeQL runs on ubuntu-latest, windows-latest, and macos-latest
runs-on: ubuntu-latest
+
permissions:
- actions: read
- contents: read
+ # required for all workflows
security-events: write
- strategy:
- fail-fast: false
- matrix:
- language: [ 'javascript' ]
- # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
- # Learn more about CodeQL language support at https://git.io/codeql-language-support
+ # only required for workflows in private repositories
+ actions: read
+ contents: read
steps:
- - name: Checkout repository
- uses: actions/checkout@v3
-
- # Initializes the CodeQL tools for scanning.
- - name: Initialize CodeQL
- uses: github/codeql-action/init@v2
- with:
- # Run extended queries including queries using machine learning
- queries: security-extended
- languages: ${{ matrix.language }}
- # If you wish to specify custom queries, you can do so here or in a config file.
- # By default, queries listed here will override any specified in a config file.
- # Prefix the list here with "+" to use these queries and those in the config file.
- # queries: ./path/to/local/query, your-org/your-repo/queries@main
-
- # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
- # If this step fails, then you should remove it and run the build manually (see below)
- - name: Autobuild
- uses: github/codeql-action/autobuild@v2
-
- # ℹ️ Command-line programs to run using the OS shell.
- # 📚 https://git.io/JvXDl
-
- # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
- # and modify them (or add more) to build your code if your project
- # uses a compiled language
-
- #- run: |
- # make bootstrap
- # make release
-
- - name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@v2
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ # Initializes the CodeQL tools for scanning.
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@v2
+ with:
+ # Run extended queries including queries using machine learning
+ queries: security-extended
+ languages: ${{ matrix.language }}
+
+ # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
+ # If this step fails, then you should remove it and run the build manually (see below).
+ - name: Autobuild
+ uses: github/codeql-action/autobuild@v2
+
+ # ℹ️ Command-line programs to run using the OS shell.
+ # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
+
+ # ✏️ If the Autobuild fails above, remove it and uncomment the following
+ # three lines and modify them (or add more) to build your code if your
+ # project uses a compiled language
+
+ #- run: |
+ # make bootstrap
+ # make release
+
+ - name: Perform CodeQL Analysis
+ uses: github/codeql-action/analyze@v2
diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-firebase-production.yml
similarity index 88%
rename from .github/workflows/deploy-prod.yml
rename to .github/workflows/deploy-firebase-production.yml
index 3a111d765..e8dd9d6cc 100644
--- a/.github/workflows/deploy-prod.yml
+++ b/.github/workflows/deploy-firebase-production.yml
@@ -1,9 +1,8 @@
-name: Deploy to Live Channel
+name: Deploy to Firebase (production)
on:
push:
- branches:
- - main
+ branches: [main]
jobs:
deploy_live_website:
diff --git a/.github/workflows/deploy-netlify.yml b/.github/workflows/deploy-netlify-production.yml
similarity index 97%
rename from .github/workflows/deploy-netlify.yml
rename to .github/workflows/deploy-netlify-production.yml
index 9a8b70648..d5d0136da 100644
--- a/.github/workflows/deploy-netlify.yml
+++ b/.github/workflows/deploy-netlify-production.yml
@@ -1,4 +1,4 @@
-name: Deploy to Netlify
+name: Deploy to Netlify (production)
on:
push:
diff --git a/.github/workflows/deploy-staging-netlify.yml b/.github/workflows/deploy-netlify-staging.yml
similarity index 95%
rename from .github/workflows/deploy-staging-netlify.yml
rename to .github/workflows/deploy-netlify-staging.yml
index 0e1d875ae..510233ac5 100644
--- a/.github/workflows/deploy-staging-netlify.yml
+++ b/.github/workflows/deploy-netlify-staging.yml
@@ -1,9 +1,10 @@
-name: Deploy to Staging Netlify
+name: Deploy to Netlify (staging)
on:
push:
- # TODO: Migrate to staging branch only
- branches: [main]
+ branches: [staging]
+ pull_request:
+ branches: [staging]
jobs:
build:
diff --git a/.github/workflows/deploy-preview-netlify.yml b/.github/workflows/deploy-preview-netlify.yml
deleted file mode 100644
index 6be28db1f..000000000
--- a/.github/workflows/deploy-preview-netlify.yml
+++ /dev/null
@@ -1,60 +0,0 @@
-name: Deploy to Preview Netlify
-
-on:
- pull_request:
- branches:
- - main
-
-jobs:
- build:
- name: Push build files to Netlify
- runs-on: ubuntu-latest
- steps:
- - name: Checkout Repository
- uses: actions/checkout@v3
-
- - name: Setup and run pnpm install
- uses: pnpm/[email protected]
- env:
- VITE_BACKEND_GQL_URL: ${{ secrets.STAGING_BACKEND_GQL_URL }}
- with:
- version: 7
- run_install: true
-
- - name: Build Site
- env:
- VITE_GA_ID: ${{ secrets.STAGING_GA_ID }}
- VITE_GTM_ID: ${{ secrets.STAGING_GTM_ID }}
- VITE_API_KEY: ${{ secrets.STAGING_FB_API_KEY }}
- VITE_AUTH_DOMAIN: ${{ secrets.STAGING_FB_AUTH_DOMAIN }}
- VITE_DATABASE_URL: ${{ secrets.STAGING_FB_DATABASE_URL }}
- VITE_PROJECT_ID: ${{ secrets.STAGING_FB_PROJECT_ID }}
- VITE_STORAGE_BUCKET: ${{ secrets.STAGING_FB_STORAGE_BUCKET }}
- VITE_MESSAGING_SENDER_ID: ${{ secrets.STAGING_FB_MESSAGING_SENDER_ID }}
- VITE_APP_ID: ${{ secrets.STAGING_FB_APP_ID }}
- VITE_BASE_URL: ${{ secrets.STAGING_BASE_URL }}
- VITE_BACKEND_GQL_URL: ${{ secrets.STAGING_BACKEND_GQL_URL }}
- VITE_BACKEND_WS_URL: ${{ secrets.STAGING_BACKEND_WS_URL }}
- VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
- VITE_SENTRY_RELEASE_TAG: ${{ github.sha }}
- VITE_SENTRY_ENVIRONMENT: staging
- run: pnpm run generate
-
- # Deploy the preview site with netlify-cli
- - name: Deploy to Netlify (preview)
- run: npx netlify-cli deploy --dir=packages/hoppscotch-web/dist --alias=preview
- env:
- NETLIFY_SITE_ID: ${{ secrets.NETLIFY_STAGING_SITE_ID }}
- NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
-
- - name: Create Sentry Release
- uses: getsentry/action-release@v1
- env:
- SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
- SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
- SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
- with:
- environment: preview
- ignore_missing: true
- ignore_empty: true
- version: ${{ github.sha }}
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 4a09c24e3..2c0984aa6 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -2,9 +2,9 @@ name: Node.js CI
on:
push:
- branches: [main]
+ branches: [main, staging]
pull_request:
- branches: [main]
+ branches: [main, staging]
jobs:
build: