Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 97 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Continuous Deployment (Build, Generate Release, Publish)
on:
push:
branches:
- master
- main
jobs:
install-cache:
name: Install-Cache
strategy:
matrix:
node-version: [22.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Cache npm dependencies
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-npm-
- name: Install Dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: npm ci

build:
name: Build
strategy:
matrix:
node-version: [22.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
needs: [install-cache]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Restore cached dependencies
uses: actions/cache@v4
id: cache-dependencies
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Build (Vite)
run: npm run build
- name: Save build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
retention-days: 1
overwrite: true

release:
name: Generate release and publish
strategy:
matrix:
node-version: [22.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
needs: [install-cache, build]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Restore cached dependencies
uses: actions/cache@v4
id: cache-dependencies
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Download saved artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Generate and publish release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
110 changes: 110 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Continuous Integration (Build, Lint, Tests)
on:
pull_request:
branches:
- develop
- master
- main
jobs:
install-cache:
name: Install-Cache
strategy:
matrix:
node-version: [22.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4 # If no branch is specified, the branch that triggered the workflow will be checked out.
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Cache npm dependencies
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-npm-
- name: Install Dependencies
# If there is a `cache-hit`, dependencies are already installed and this step is skipped.
# If there is no `cache-hit`, we install the dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: npm ci
lint:
name: Lint
strategy:
matrix:
node-version: [22.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
needs: install-cache # Wait for `install-cache` job to complete so that the dependencies are installed and cached.
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
# Restore the npm dependencies from the actions/cache.
# At this stage of the workflow the dependencies have been installed and cached.
- name: Restore cached dependencies
uses: actions/cache@v4
id: cache-dependencies
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Lint (ESLint)
run: npm run lint:no-fix
tests:
name: Tests
strategy:
matrix:
node-version: [22.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
needs: install-cache # Wait for `install-cache` job to complete so that the dependencies are installed and cached.
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Restore cached dependencies
uses: actions/cache@v4
id: cache-dependencies
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Tests (Vitest)
run: npm run test
build:
name: Build
strategy:
matrix:
node-version: [22.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
needs: [install-cache, lint, tests] # If previous jobs succeed, then run this build.
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Restore cached dependencies
uses: actions/cache@v4
id: cache-dependencies
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Build (Vite)
run: npm run build
Loading