-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add npm deployment workflow and update package files
- Loading branch information
Showing
5 changed files
with
519 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Deploy to npm | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
publish-npm: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Checkout the repository | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
# Set up Node.js environment | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18' | ||
registry-url: 'https://registry.npmjs.org/' | ||
|
||
# Install dependencies | ||
- name: Install dependencies | ||
run: npm install | ||
|
||
# Get the short hash of the last commit | ||
- name: Get short commit hash | ||
id: get_hash | ||
run: echo "HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | ||
|
||
# Update the version in package.json | ||
- name: Update version | ||
run: | | ||
VERSION="0.0.1-alpha.$HASH" | ||
jq --arg ver "$VERSION" '.version = $ver' package.json > tmp.json && mv tmp.json package.json | ||
# Build the package | ||
- name: Build package | ||
run: npm run build | ||
|
||
# Run tests | ||
- name: Run tests | ||
run: npm test | ||
|
||
# Publish to npm | ||
- name: Publish to npm | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
run: npm publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Ignore the following common files and directories: | ||
|
||
# Node.js modules | ||
node_modules/ | ||
|
||
# Ignore development files and directories | ||
dist/ # Exclude the build output directory (if not needed) | ||
src/ # Exclude the source files (if only publishing dist) | ||
|
||
# Ignore common configuration files | ||
.eslintignore # ESLint ignore file | ||
.eslintrc # ESLint config file | ||
.babelrc # Babel config file | ||
.npmrc # npm config file | ||
.vscode/ # VS Code settings folder | ||
.git/ # Git version control directory | ||
|
||
# Ignore testing files and directories | ||
tests/ # Exclude any test directories | ||
test/ # Exclude any test directories | ||
**/*.test.js # Ignore all test files with .test.js extension | ||
|
||
# Ignore other common files | ||
*.log # Ignore log files | ||
*.tmp # Ignore temporary files | ||
*.lock # Ignore lock files (except package-lock.json if you want to keep it) | ||
webpack.config.js # Ignore Webpack config (if not needed) | ||
README.md # You might want to include this for documentation | ||
|
||
# Ignore specific folders and files as needed | ||
app/ # Exclude the app directory |
Oops, something went wrong.