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: 0 additions & 97 deletions .github/workflows/cd-publish.yml

This file was deleted.

69 changes: 58 additions & 11 deletions .github/workflows/cd-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Continuous Deployment (Release)
name: Continuous Deployment

on:
push:
Expand All @@ -9,20 +9,67 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false

# Step 1: Run commitlint to ensure commit messages follow conventional commit format
- name: Set up Node.js
uses: actions/setup-node@v2
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '16'
node-version: 20
cache: 'pnpm'
cache-dependency-path: './pnpm-lock.yaml'

- name: Install dependencies
run: npm install
run: pnpm install --frozen-lockfile

- name: Run standard-version
run: pnpm run release

# Step 2: Bump the version and create a tag using semantic-release
- name: Setup semantic-release
uses: semantic-release/semantic-release@v20
- name: Push release commit and tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git push --follow-tags
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build
run: pnpm run build

- name: Configure npm token
run: |
cat << EOF >> "./.npmrc"
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
@avenue3-dev:registry=https://registry.npmjs.org
always-auth=true
EOF
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish NPM package
run: pnpm publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Configure github token
run: |
cat << EOF >> "./.npmrc"
//npm.pkg.github.com/:_authToken=${NPM_TOKEN}
@avenue3-dev:registry=https://npm.pkg.github.com
always-auth=true
EOF
env:
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish github package
run: pnpm publish --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"description": "A utility for formatting age",
"private": false,
"scripts": {
"release": "standard-version",
"build": "rimraf dist/ && tsc --project tsconfig.build.json",
"test": "vitest run",
"lint": "eslint src --ext ts,tsx,js --report-unused-disable-directives --fix",
Expand All @@ -26,6 +27,7 @@
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"rimraf": "^6.0.1",
"standard-version": "^9.5.0",
"typescript": "^5.8.3",
"vitest": "^3.1.3"
}
Expand Down
Loading