Skip to content

Commit

Permalink
refactor/Workflow for CI and CD to npmjs
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas committed Apr 4, 2024
1 parent bf40298 commit f282966
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 4 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/cd-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Continuous Deployment Pipeline

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
scope: '@heikkkk'
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
40 changes: 40 additions & 0 deletions .github/workflows/ci-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Continuous Integration

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build-and-test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Install dependencies
run: npm install

- name: Run linter
run: npm run lint

- name: Check formatting
run: npm run format -- --check

- name: Run unit tests
run: npm run test:unit

- name: Build the project
run: npm run build
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"name": "@heikkkk/idatt2105-semester-project-frontend",
"version": "1.0.0",
"publishConfig": {
"registry": "https://npm.pkg.github.com/@heikkkk"
},
"registry": "https://registry.npmjs.org/"
},
"repository": {
"type": "git",
"url": "git://github.com/heikkkk/IDATT2105-Semester-Project-Frontend.git"
},
"private": true,
"private": false,
"type": "module",
"scripts": {
"dev": "vite",
Expand All @@ -24,8 +24,11 @@
"@fortawesome/fontawesome-free": "^6.5.1",
"@fortawesome/fontawesome-svg-core": "^6.5.1",
"axios": "^1.6.8",
"express": "^4.19.2",
"jest": "^29.7.0",
"pinia": "^2.1.7",
"pinia-plugin-persistedstate": "^3.2.1",
"supertest": "^6.3.4",
"vue": "^3.4.21",
"vue-router": "^4.2.5"
},
Expand All @@ -45,4 +48,4 @@
"vite": "^5.2.6",
"vitest": "^1.4.0"
}
}
}

0 comments on commit f282966

Please sign in to comment.