diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 000000000..be447076a --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -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 diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 000000000..be2b4f04a --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -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 diff --git a/.github/workflows/publish-prod-api.yml b/.github/workflows/publish-prod-api.yml index 1cd3bc945..2d4832cbc 100644 --- a/.github/workflows/publish-prod-api.yml +++ b/.github/workflows/publish-prod-api.yml @@ -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 diff --git a/.github/workflows/publish-prod-embed.yml b/.github/workflows/publish-prod-embed.yml index 3ffd4d461..aecb11ec0 100644 --- a/.github/workflows/publish-prod-embed.yml +++ b/.github/workflows/publish-prod-embed.yml @@ -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 diff --git a/.github/workflows/publish-prod-queue-manager.yml b/.github/workflows/publish-prod-queue-manager.yml index 032dc4241..c19809d65 100644 --- a/.github/workflows/publish-prod-queue-manager.yml +++ b/.github/workflows/publish-prod-queue-manager.yml @@ -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 diff --git a/.github/workflows/publish-prod-react.yml b/.github/workflows/publish-prod-react.yml index d182f5676..7715cc7d4 100644 --- a/.github/workflows/publish-prod-react.yml +++ b/.github/workflows/publish-prod-react.yml @@ -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 @@ -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 }} diff --git a/.github/workflows/publish-prod-widget.yml b/.github/workflows/publish-prod-widget.yml index 401b83617..03dbd9017 100644 --- a/.github/workflows/publish-prod-widget.yml +++ b/.github/workflows/publish-prod-widget.yml @@ -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 diff --git a/.github/workflows/tag-images.yml b/.github/workflows/tag-images.yml new file mode 100644 index 000000000..e1ce4ad02 --- /dev/null +++ b/.github/workflows/tag-images.yml @@ -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" +