Skip to content

Commit d1e4698

Browse files
chore: setting up publish workflow completely
1 parent 6c6bee3 commit d1e4698

File tree

4 files changed

+1260
-1244
lines changed

4 files changed

+1260
-1244
lines changed

.github/workflows/publish.yml

+38-26
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,58 @@
1-
name: Publish to NPM
1+
name: Publish nopalm to npm registry
22

33
on:
44
push:
55
branches:
66
- main
7+
pull_request:
8+
branches:
9+
- main
710

811
jobs:
9-
release:
12+
versioning:
1013
runs-on: ubuntu-latest
11-
1214
steps:
13-
- name: Checkout repository
14-
uses: actions/checkout@v3
15+
# Checkout the code
16+
- name: Checkout code
17+
uses: actions/checkout@v2
1518

16-
- name: Setup Node.js
19+
# Set up Node.js environment
20+
- name: Set up Node.js
1721
uses: actions/setup-node@v3
1822
with:
1923
node-version: '20'
20-
cache: 'yarn'
2124

25+
# Install dependencies
2226
- name: Install dependencies
23-
run: yarn install
27+
run: yarn install --frozen-lockfile --production
2428

25-
- name: Automate versioning and changelog
26-
id: version
27-
uses: actions-ecosystem/action-update-semver@v2
28-
with:
29-
update_type: auto # Options: major, minor, patch, or auto
29+
# Run linting
30+
- name: Run lint
31+
run: yarn lint
3032

31-
- name: Set Yarn version
32-
run: yarn version --new-version ${{ steps.version.outputs.new_version }} --no-git-tag-version
33+
# Run tests
34+
- name: Run tests
35+
run: yarn test
3336

34-
- name: Publish to NPM
35-
env:
36-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
37-
run: yarn publish --non-interactive
37+
# Build production version of react client
38+
- name: Build client
39+
run: yarn build-client
3840

39-
- name: Push changes back to repo
41+
# Semantic release step: Automatically determine the version and release
42+
- name: Semantic Release for versioning
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4046
run: |
41-
git config user.name "github-actions[bot]"
42-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
43-
git add package.json yarn.lock
44-
git commit -m "chore(release): publish ${{ steps.version.outputs.new_version }}"
45-
git tag v${{ steps.version.outputs.new_version }}
46-
git push --follow-tags
47+
yarn release
48+
49+
# Optionally, you can include a job to deploy to npm
50+
publish:
51+
needs: release
52+
runs-on: ubuntu-latest
53+
steps:
54+
# Publish to npm
55+
- name: Publish to npm
56+
run: yarn publish --non-interactive
57+
env:
58+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

client/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
8-
"build": "yarn lint --fix && tsc && vite build --mode production",
8+
"build": "yarn && yarn lint --fix && tsc && vite build --mode production",
99
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
1010
"preview": "vite preview"
1111
},

0 commit comments

Comments
 (0)