Skip to content

Commit

Permalink
Updated the build pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
securingsincity committed Nov 2, 2024
1 parent cf73f07 commit f762bd6
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 65 deletions.
53 changes: 14 additions & 39 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
# The branches below must be a subset of the branches above
branches: [main]
schedule:
- cron: '0 17 * * 3'
- cron: "0 17 * * 3"

jobs:
analyze:
Expand All @@ -17,46 +17,21 @@ jobs:
strategy:
fail-fast: false
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['javascript']
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
language: ["javascript"]

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# 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@v1

# ℹ️ 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@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
32 changes: 22 additions & 10 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: CI
name: Node.js CI

on:
push:
Expand All @@ -19,18 +19,30 @@ jobs:
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
- run: npm run lint
- run: npm run coverage
- run: npm run build:example

- name: Deploy
- name: Install dependencies
run: npm ci

- name: Build project
run: npm run build --if-present

- name: Lint code
run: npm run lint

- name: Run tests and collect coverage
run: npm run coverage

- name: Build example
run: npm run build:example

- name: Deploy to GitHub Pages
if: ${{ github.ref == 'refs/heads/main' }}
uses: peaceiris/actions-gh-pages@v3
with:
Expand Down
37 changes: 21 additions & 16 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Node.js Package
name: Publish to npm

on:
release:
types: [published]
Expand All @@ -7,35 +8,39 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
# "ref" specifies the branch to check out.
# "github.event.release.target_commitish" is a global variable and specifies the branch the release targeted
ref: ${{ github.event.release.target_commitish }}
- uses: actions/setup-node@v1

- uses: actions/setup-node@v3
with:
node-version: 20
registry-url: https://registry.npmjs.org/

- run: npm ci

- run: npm test

- run: npm run build

- run: git config --global user.name "GitHub CD bot"

- run: git config --global user.email "[email protected]"
- run: npm version ${{ github.event.release.tag_name }} --no-git-tag-version

- run: npm version ${{ github.event.release.tag_name }} --no-git-tag-version

- run: git add . && git commit -m "[Release] ${{ github.event.release.tag_name }}"

- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Upload a Build Artifact
uses: actions/upload-artifact@v2.2.2
uses: actions/upload-artifact@v3
with:
# Artifact name
name:
react-ace.min.js
# A file, directory or wildcard pattern that describes what to upload
path:
dist/react-ace.min.js
# The desired behavior if no files are found using the provided path.
name: react-ace.min.js
path: dist/react-ace.min.js

- run: git push
env:
github-token: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit f762bd6

Please sign in to comment.