Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

Commit

Permalink
ci(github): enable semantic-release in workflow (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbolel authored Jun 1, 2023
1 parent fd257d3 commit 49d94c5
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 37 deletions.
39 changes: 26 additions & 13 deletions .github/workflows/tests.yaml → .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name: TESTS
# Workflow that lints code, runs tests, and builds the project. On pushes
# to the main branch, also creates a version and create a release on GitHub.
name: CI/CD

on:
push:
Expand All @@ -13,16 +15,24 @@ on:
- synchronize

jobs:
frontend:
test_build_release:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [19]

env:
CI: true

steps:
- name: CHECKOUT
uses: actions/checkout@v3

- name: INSTALL- nodejs, yarn
- name: INSTALL - node.js, yarn
uses: actions/setup-node@v3
with:
node-version: 19
node-version: ${{ matrix.node-version }}
cache: 'yarn'
cache-dependency-path: 'yarn.lock'

Expand All @@ -32,30 +42,33 @@ jobs:
echo "npm --version: $(npm --version)"
echo "yarn --version: $(yarn --version)"
- name: CACHE - get folder path
id: yarn-cache-dir-path
- name: CACHE - get yarn cache folder path
id: yarn-cache-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- name: CACHE - .yarn/
- name: CACHE - yarn dependencies
id: yarn-cache
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-cache-folder-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }}
path: ${{ steps.yarn-cache-path.outputs.dir }}
key: node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }}
restore-keys: |
yarn-cache-folder-
node-${{ matrix.node-version }}-yarn-
- name: INSTALL - dependencies
run: CI=true yarn install
run: yarn install --immutable

- name: LINT
run: yarn lint

- name: TEST - unit
- name: TEST
run: yarn test

- name: BUILD
run: yarn build

- name: VERSION
# semantic-release will only run on pushes to main (see package.json)
- name: RELEASE
run: yarn semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41 changes: 17 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
{
"name": "sbom-harbor-ui",
"private": true,
"version": "0.0.0",
"type": "module",
"version": "0.0.0-semantic-release",
"license": "UNLICENSED",
"description": "SBOM Harbor UI",
"homepage": "https://github.com/CMS-Enterprise/sbom-harbor-ui/#readme",
"bugs": {
"url": "https://github.com/CMS-Enterprise/sbom-harbor-ui/issues"
},
"type": "module",
"scripts": {
"start": "yarn run dev",
"dev": "vite",
"build": "tsc -p tsconfig.prod.json && vite build --mode production",
"preview": "vite preview",
"clean": "rimraf dist",
"test": "NODE_ENV=test jest --all --coverage --colors",
"test:ci": "NODE_ENV=test jest --all --watchAll=false --ci",
"test:precommit": "NODE_ENV=test jest --coverage --colors --onlyChanged --watch=false",
"test:watch": "NODE_ENV=test jest --coverage --onlyChanged --colors --watch",
"lint": "run-p 'lint:js' 'lint:other'",
"lint:js": "eslint ./ --ext ts,tsx,js,jsx,cjs -c .eslintrc.cjs --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint --color --report-unused-disable-directives",
"lint:other": "prettier --check '**/*.{json,md,yaml,yml}' --ignore-path .gitignore --ignore-path .prettierignore",
"fix": "run-p 'fix:js' 'fix:other'",
"fix": "run-p 'fix:**'",
"fix:js": "yarn run lint:js --fix",
"fix:other": "yarn run lint:other --write",
"semantic-release": "semantic-release",
Expand All @@ -26,7 +32,7 @@
"packageManager": "[email protected]",
"engines": {
"node": "19",
"npm": "9.6.5",
"npm": "9.6.6",
"yarn": "3.5.1"
},
"dependencies": {
Expand Down Expand Up @@ -169,30 +175,17 @@
{
"assets": [
{
"path": "dist/index.html",
"label": "index.html"
},
{
"path": "dist/*.(svg|png|jpg|jpeg|gif|webp|ico|tif|tiff|bmp)",
"label": "Public images"
"path": "dist",
"label": "Distribution"
},
{
"path": "dist/assets/*.js",
"label": "JS distribution"
"path": "CHANGELOG.md",
"label": "Changelog"
},
{
"path": "dist/assets/*.css",
"label": "CSS distribution"
},
{
"path": "dist/assets/*.(svg|png|jpg|jpeg|gif|webp|ico|tif|tiff|bmp)",
"label": "IMG distribution"
},
{
"path": "(README|CHANGELOG).md",
"label": "Documentation"
},
"package.json"
"path": "README.md",
"label": "Readme"
}
]
}
]
Expand Down

0 comments on commit 49d94c5

Please sign in to comment.