-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added github actions for test and npm-release
- Loading branch information
Abhinaba Ghosh
authored and
Abhinaba Ghosh
committed
Jan 10, 2024
1 parent
d94a729
commit bf58f66
Showing
2 changed files
with
74 additions
and
0 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,55 @@ | ||
name: NPM Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
versionType: | ||
description: 'Version type (major, minor, patch)' | ||
required: true | ||
default: 'patch' | ||
branches: | ||
- master | ||
|
||
jobs: | ||
npm-release: | ||
if: github.ref == 'refs/heads/master' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 # fetch all history so that we can determine the version bump | ||
|
||
- name: Configure Git | ||
run: | | ||
git config --global user.name "${{ secrets.GIT_USER_NAME }}" | ||
git config --global user.email "${{ secrets.GIT_USER_EMAIL }}" | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16' | ||
registry-url: 'https://registry.npmjs.org/' | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Run Tests | ||
run: | | ||
npx playwright install --with-deps chromium | ||
npm test | ||
- name: Bump version | ||
run: npm version ${{ github.event.inputs.versionType }} -m "Upgrade to %s" | ||
|
||
- name: Publish to npm | ||
run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
- name: Push changes and tags | ||
run: | | ||
git config user.name "${{ secrets.GIT_USER_NAME }}" | ||
git config user.email "${{ secrets.GIT_USER_EMAIL }}" | ||
git push | ||
git push --tags |
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,19 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16' | ||
cache: 'npm' | ||
- run: npm install | ||
- run: npx playwright install --with-deps chromium | ||
- run: npm test |