Skip to content

Commit

Permalink
ci: update pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Dokuqui committed Feb 18, 2024
1 parent bd4c14f commit 5da9605
Showing 1 changed file with 68 additions and 16 deletions.
84 changes: 68 additions & 16 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,34 @@
name: Node.js CI/CD
name: Force Version CI/CD

on:
push:
branches:
- main

pull_request:
branches: [ main ]

jobs:
lint:
name: Lint Code Base
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Lint Code Base
uses: github/super-linter@v4
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: master
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_JSCPD: false
VALIDATE_TYPESCRIPT_STANDARD: false
VALIDATE_MARKDOWN: false

install:
runs-on: ubuntu-latest

Expand Down Expand Up @@ -36,6 +59,27 @@ jobs:
mkdir -p ~/.npm
cp -R node_modules ~/.npm/
build:
name: Build
needs: lint
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: pnpm/action-setup@v2
with:
version: latest
run_install: true
- name: Build
run: pnpm run build
- name: Upload build
uses: actions/upload-artifact@v3
with:
name: build
path: dist

test:
runs-on: ubuntu-latest
needs: install
Expand Down Expand Up @@ -64,23 +108,31 @@ jobs:
- name: Run unit tests
run: npm run test-coverage

publish:
release:
name: Release
runs-on: ubuntu-latest
needs: test

if: github.event_name == 'push'
needs:
- build
- test
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Dependencies
- uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '20.11.1'

- name: Authenticate with npm
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}" > ~/.npmrc

- name: Publish to npm
run: npm publish
node-version: 18
- uses: pnpm/action-setup@v2
with:
version: latest
run_install: |
- recursive: false
- name: Download build
uses: actions/download-artifact@v3
with:
name: build
path: dist
- run: mkdir -p docs
- run: pnpx semantic-release
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

0 comments on commit 5da9605

Please sign in to comment.