Skip to content

Commit

Permalink
add test & build github action for every merge/commit into main branc…
Browse files Browse the repository at this point in the history
…h - change ci / publish yml file name and give it public access config
  • Loading branch information
michael-gee committed Jan 5, 2024
1 parent a9e4833 commit 13e77c4
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 11 deletions.
21 changes: 13 additions & 8 deletions .github/workflows/ci.yml → .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: communitils ci
name: communitils publish ci

on:
push:
tags: 'v*'
tags: ['v*']

jobs:
test:
Expand All @@ -15,10 +15,12 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npm test
- name: Install dependencies 📦
run: npm ci
- name: Run tests ✅
run: npm test

publish-npm:
publish:
needs: test
runs-on: ubuntu-latest
steps:
Expand All @@ -27,8 +29,11 @@ jobs:
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run build
- run: npm publish
- name: Install dependencies 📦
run: npm ci
- name: Run build 🔧
run: npm run build
- name: Publish to NPM 🚢
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
33 changes: 33 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: communitils test & build

on:
push:
branches: ['main']

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies 📦
run: npm ci
- name: Run build 🔧
run: npm run build

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies 📦
run: npm ci
- name: Run tests ✅
run: npm test
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "communitils",
"version": "0.3.2",
"description": "Breaking into open-source with a TypeScript utility package while inviting others to do the same.",
"version": "0.3.3",
"type": "module",
"packageManager": "npm@20.10.0",
"main": "dist/index.cjs",
Expand Down

0 comments on commit 13e77c4

Please sign in to comment.