Skip to content

Add index.md landing page for GitHub Pages #17

Add index.md landing page for GitHub Pages

Add index.md landing page for GitHub Pages #17

Workflow file for this run

name: CI/CD
on:
push:
branches:
- main
permissions:
contents: write
jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.10.0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Install Dependencies
run: pnpm install
- name: Build Package
run: pnpm run build
- name: Run Tests with Coverage
run: pnpm run test:coverage
- name: Upload Coverage Report (GitHub Artifact)
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage/
- name: Upload to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/lcov.info
flags: unittests
name: codecov-coverage
fail_ci_if_error: true
publish:
needs: ci
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org/'
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
- name: Check version
id: check
run: |
PUBLISHED_VERSION=$(npm view diabetic-utils version 2>/dev/null || echo "0.0.0")
PACKAGE_VERSION=$(node -p "require('./package.json').version")
echo "version=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
if [ "$PUBLISHED_VERSION" = "$PACKAGE_VERSION" ]; then
echo "Version $PACKAGE_VERSION already published, skipping..."
echo "skip=true" >> $GITHUB_OUTPUT
else
echo "Publishing version $PACKAGE_VERSION..."
echo "skip=false" >> $GITHUB_OUTPUT
fi
- name: Publish to npm
if: steps.check.outputs.skip != 'true'
run: pnpm publish --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create Release
if: steps.check.outputs.skip != 'true'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.check.outputs.version }}
release_name: Release v${{ steps.check.outputs.version }}
body: |
Release of version ${{ steps.check.outputs.version }}
Please refer to [CHANGELOG.md](./CHANGELOG.md) for details.