Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add github actions #5

Merged
merged 7 commits into from
May 25, 2024
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
72 changes: 72 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: CI/CD Pipeline

on:
pull_request:
types: ['opened', 'edited', 'reopened', 'synchronize']
push:
branches:
- main

jobs:
typecheck:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: pnpm/[email protected]
with:
version: 9.1.1
- name: Use Node.js
uses: actions/[email protected]
with:
node-version: 20
cache: 'pnpm'
- run: pnpm install
- run: pnpm run build
- run: pnpm install
- run: pnpm typecheck
test:
runs-on: ubuntu-22.04
needs: [typecheck]
strategy:
matrix:
node: ['20']
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- uses: pnpm/[email protected]
with:
version: 9.1.1
- name: Use Node.js
uses: actions/[email protected]
with:
node-version: ${{ matrix.node }}
cache: 'pnpm'
- run: pnpm install
- run: pnpm run build
- run: pnpm install
- run: pnpm run coverage
- name: Upload coverage report
if: success()
uses: actions/upload-artifact@v2
with:
name: coverage-report
path: coverage/lcov-report/index.html

build:
strategy:
matrix:
node: ['20']
runs-on: ubuntu-22.04
needs: [typecheck]
steps:
- uses: actions/checkout@v4 # v4.1.4
- uses: pnpm/[email protected]
with:
version: 9.1.1
- name: Use Node.js
uses: actions/[email protected]
with:
node-version: ${{ matrix.node }}
- run: pnpm install
- run: pnpm run build
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release

on:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Checkout code
uses: actions/checkout@v2

- uses: pnpm/[email protected]
with:
version: 9.1.1
- name: Use Node.js
uses: actions/[email protected]
with:
node-version: 20.x
cache: 'pnpm'
- run: pnpm install
- run: pnpm run build

- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
15 changes: 13 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
{
"name": "unused-i18n",
"version": "0.1.6",
"version": "0.1.8",
"license": "MIT",
"type": "module",
"release": {
"branches": [
"main"
]
},
"repository": {
"type": "git",
"url": "https://github.com/Lawndlwd/unused-i18n.git"
Expand All @@ -14,6 +19,7 @@
},
"scripts": {
"build": "rollup -c",
"typecheck": "tsc --noEmit",
"start": "ts-node src/index.ts",
"test": "vitest",
"coverage": "vitest run --coverage"
Expand All @@ -32,9 +38,14 @@
"@vitest/coverage-istanbul": "^1.6.0",
"rollup": "^4.18.0",
"rollup-plugin-dts": "^6.1.1",
"ts-node": "^9.1.1",
"rollup-plugin-filesize": "^10.0.0",
"ts-node": "^9.1.1",
"tslib": "^2.6.2",
"typescript": "^4.9.5",
"vitest": "^1.6.0"
},
"engines": {
"node": ">=18.x",
"pnpm": ">=9.x"
}
}
Loading
Loading