-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
52 additions
and
61 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
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 |
---|---|---|
@@ -1,9 +1,6 @@ | ||
name: Release Workflow | ||
name: Release & Publish ro NPM | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
on: workflow_dispatch | ||
|
||
jobs: | ||
release: | ||
|
@@ -17,36 +14,31 @@ jobs: | |
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18' # specify your Node.js version here | ||
node-version: '18' | ||
|
||
# Installing dependencies | ||
- name: Install Dependencies | ||
run: npm install | ||
run: npm ci | ||
|
||
# Building the project | ||
- name: Build | ||
run: npm build | ||
|
||
# Preparing package for release | ||
- name: Prepare Package | ||
run: cp package.json README.md pkg/ | ||
# Initializing git config | ||
- name: Initialize git user | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Release n Publish Workflow" | ||
# Switching to 'releases' branch | ||
- name: Switch to Releases Branch | ||
run: git checkout releases | ||
# Initializing the npm with the $NPM_TOKEN | ||
- name: Initialize the NPM config | ||
run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
# Cleaning and updating the branch | ||
- name: Update Releases Branch | ||
run: | | ||
git rm -rf ./* | ||
cp -R pkg/* . | ||
git add . | ||
git commit -m "auto-generate release $(git rev-parse --short HEAD)" | ||
git push origin releases | ||
# Building the project | ||
- name: Build | ||
run: npm tsc | ||
|
||
# Running release-it | ||
- name: Release to NPM | ||
run: npm run release | ||
run: npm run release -- --ci | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
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 |
---|---|---|
|
@@ -132,3 +132,4 @@ dist | |
/pkg | ||
.idea | ||
.DS_Store | ||
.npmrc |
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,30 @@ | ||
{ | ||
"git": { | ||
"requireBranch": "main", | ||
"commitMessage": "chore: release v${version}" | ||
}, | ||
"github": { | ||
"release": true | ||
}, | ||
"npm": { | ||
"publish": true | ||
}, | ||
"plugins": { | ||
"@release-it/conventional-changelog": { | ||
"infile": "CHANGELOG.md", | ||
"preset": { | ||
"name": "conventionalcommits", | ||
"types": [ | ||
{ | ||
"type": "feat", | ||
"section": "Features" | ||
}, | ||
{ | ||
"type": "fix", | ||
"section": "Bug Fixes" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
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