Skip to content

Commit

Permalink
Merge pull request #72 from knovator/feat/deployment-updates
Browse files Browse the repository at this point in the history
Workflow Updates
  • Loading branch information
chavda-bhavik authored Nov 19, 2022
2 parents 7ead166 + 6f79def commit 29b2f77
Show file tree
Hide file tree
Showing 8 changed files with 198 additions and 38 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# 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"

on:
push:
branches: [ "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
schedule:
- cron: '25 2 * * 4'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript', 'typescript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
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.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# 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.
# 📚 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.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
21 changes: 21 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Dependency Review Action
#
# This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging.
#
# Source repository: https://github.com/actions/dependency-review-action
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
name: 'Dependency Review'
on: [pull_request]

permissions:
contents: read

jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v3

- name: 'Dependency Review'
uses: actions/dependency-review-action@v2
14 changes: 7 additions & 7 deletions .github/workflows/publish-prod-api.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Publish API to Production

# Triggers the workflow on merge in main branch
on:
pull_request:
branches:
- main
types: [closed]
push:
tags:
- '**@impler/api@**'
- '**@impler/shared@**'
- '**@impler/dal@**'
workflow_dispatch:

jobs:
publish_prod_api:
# run only if pull request is merged into main branch
if: ${{ github.event.pull_request.merged }} && !contains(github.event.head_commit.message, 'ci skip')
if: "!contains(github.event.head_commit.message, 'ci skip')"
# The type of runner that the job will run on
runs-on: ubuntu-latest
timeout-minutes: 80
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/publish-prod-embed.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
name: Publish Embed to Production

# Triggers the workflow on merge in main branch
on:
pull_request:
branches:
- main
types: [closed]
push:
tags:
- '**@impler/embed@**'
workflow_dispatch:

jobs:
publish_prod_embed:
# run only if pull request is merged into main branch
if: ${{ github.event.pull_request.merged }} && !contains(github.event.head_commit.message, 'ci skip')
if: "!contains(github.event.head_commit.message, 'ci skip')"
# The type of runner that the job will run on
runs-on: ubuntu-latest
timeout-minutes: 80
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/publish-prod-queue-manager.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
name: Publish Queue Manager to Production

# Triggers the workflow on merge in main branch
on:
pull_request:
branches:
- main
types: [closed]
push:
tags:
- '**@impler/queue-manager@**'
- '**@impler/shared@**'
workflow_dispatch:

jobs:
publish_prod_queue-manager:
# run only if pull request is merged into main branch
if: ${{ github.event.pull_request.merged }} && !contains(github.event.head_commit.message, 'ci skip')
if: "!contains(github.event.head_commit.message, 'ci skip')"
# The type of runner that the job will run on
runs-on: ubuntu-latest
timeout-minutes: 80
Expand Down
18 changes: 8 additions & 10 deletions .github/workflows/publish-prod-react.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
name: Publish React to NPM Registry

# Triggers the workflow on merge in main branch
on:
pull_request:
branches:
- main
types: [closed]
push:
tags:
- '**@impler/react@**'
workflow_dispatch:

jobs:
publish_prod_react:
# run only if pull request is merged into main branch
if: ${{ github.event.pull_request.merged }} && !contains(github.event.head_commit.message, 'ci skip')
if: "!contains(github.event.head_commit.message, 'ci skip')"
# The type of runner that the job will run on
runs-on: ubuntu-latest
timeout-minutes: 80
Expand Down Expand Up @@ -42,8 +40,8 @@ jobs:
version: 7.9.4
run_install: true

- name: Publish
uses: JS-DevTools/npm-publish@v1
- name: Publish package to NPM 📦
working-directory: apps/widget
run: npm publish --access public
with:
token: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
13 changes: 6 additions & 7 deletions .github/workflows/publish-prod-widget.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
name: Publish Widget to Production

# Triggers the workflow on merge in main branch
on:
pull_request:
branches:
- main
types: [closed]
push:
tags:
- '**@impler/widget@**'
- '**@impler/shared@**'
workflow_dispatch:

jobs:
publish_prod_widget:
# run only if pull request is merged into main branch
if: ${{ github.event.pull_request.merged }} && !contains(github.event.head_commit.message, 'ci skip')
if: "!contains(github.event.head_commit.message, 'ci skip')"
# The type of runner that the job will run on
runs-on: ubuntu-latest
timeout-minutes: 80
Expand Down
73 changes: 73 additions & 0 deletions .github/workflows/tag-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Tag Docker Version

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
workflow_dispatch:
inputs:
version:
description: 'The version to tag docker images'
required: true
type: string

jobs:
tag_images:
runs-on: ubuntu-latest
timeout-minutes: 80
environment: Production
permissions:
contents: read
packages: write
deployments: write
steps:
- name: Login to docker
env:
GH_ACTOR: knovator
GH_PASSWORD: ${{ secrets.GH_PACKAGES }}
run: |
echo $GH_PASSWORD | docker login ghcr.io -u $GH_ACTOR --password-stdin
- name: Tag API
env:
REGISTERY_OWNER: knovator
DOCKER_NAME: impler/api
DOCKER_VERSION: ${{ inputs.version }}
run: |
docker pull ghcr.io/$REGISTERY_OWNER/$DOCKER_NAME:prod
docker tag ghcr.io/$REGISTERY_OWNER/$DOCKER_NAME:prod ghcr.io/$REGISTERY_OWNER/$DOCKER_NAME:$DOCKER_VERSION
docker push ghcr.io/$REGISTERY_OWNER/$DOCKER_NAME:$DOCKER_VERSION
echo "::set-output name=IMAGE::ghcr.io/$REGISTERY_OWNER/$DOCKER_NAME:$DOCKER_VERSION"
- name: Tag Queue Manager
env:
REGISTERY_OWNER: knovator
DOCKER_NAME: impler/queue-manager
DOCKER_VERSION: ${{ inputs.version }}
run: |
docker pull ghcr.io/$REGISTERY_OWNER/$DOCKER_NAME:prod
docker tag ghcr.io/$REGISTERY_OWNER/$DOCKER_NAME:prod ghcr.io/$REGISTERY_OWNER/$DOCKER_NAME:$DOCKER_VERSION
docker push ghcr.io/$REGISTERY_OWNER/$DOCKER_NAME:$DOCKER_VERSION
echo "::set-output name=IMAGE::ghcr.io/$REGISTERY_OWNER/$DOCKER_NAME:$DOCKER_VERSION"
- name: Tag EMBED
env:
REGISTERY_OWNER: knovator
DOCKER_NAME: impler/embed
DOCKER_VERSION: ${{ inputs.version }}
run: |
docker pull ghcr.io/$REGISTERY_OWNER/$DOCKER_NAME:prod
docker tag ghcr.io/$REGISTERY_OWNER/$DOCKER_NAME:prod ghcr.io/$REGISTERY_OWNER/$DOCKER_NAME:$DOCKER_VERSION
docker push ghcr.io/$REGISTERY_OWNER/$DOCKER_NAME:$DOCKER_VERSION
echo "::set-output name=IMAGE::ghcr.io/$REGISTERY_OWNER/$DOCKER_NAME:$DOCKER_VERSION"
- name: Tag WIDGET
env:
REGISTERY_OWNER: knovator
DOCKER_NAME: impler/widget
DOCKER_VERSION: ${{ inputs.version }}
run: |
docker pull ghcr.io/$REGISTERY_OWNER/$DOCKER_NAME:prod
docker tag ghcr.io/$REGISTERY_OWNER/$DOCKER_NAME:prod ghcr.io/$REGISTERY_OWNER/$DOCKER_NAME:$DOCKER_VERSION
docker push ghcr.io/$REGISTERY_OWNER/$DOCKER_NAME:$DOCKER_VERSION
echo "::set-output name=IMAGE::ghcr.io/$REGISTERY_OWNER/$DOCKER_NAME:$DOCKER_VERSION"

0 comments on commit 29b2f77

Please sign in to comment.