-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added release-please for versioning, changelog generation, github release, and npm publish
- Loading branch information
Showing
5 changed files
with
96 additions
and
7 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
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,40 @@ | ||
# This workflow is to create a release PR for a specified version. | ||
# It can be trigger manually with the version as an input. | ||
# Once the PR is merged into main branch the release.yml workflow | ||
# will start the release process. | ||
name: 'Release PR' | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Enter version (Eg: 1.3.0)' | ||
required: true | ||
|
||
permissions: {} | ||
jobs: | ||
release-please: | ||
permissions: | ||
contents: write # to create release commit (google-github-actions/release-please-action) | ||
pull-requests: write # to create release PR (google-github-actions/release-please-action) | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Display Release version | ||
run: echo "Creating release PR for ${{ github.event.inputs.version }}" | ||
|
||
- name: Create Release PR | ||
uses: google-github-actions/release-please-action@v3 | ||
id: release | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
release-type: node | ||
package-name: nepali-datetime | ||
release-as: '${{ github.event.inputs.version }}' | ||
pull-request-title-pattern: 'chore: release v${version}' | ||
pull-request-header: 'Release PR for v${{ github.event.inputs.version }}' | ||
changelog-types: > | ||
[ | ||
{"type":"fix","section":"Bug Fixes"}, | ||
{"type":"feat","section":"Features"} | ||
] |
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,52 @@ | ||
# Creates a Github release and NPM publish after the merge of | ||
# release PR created by release-pr.yml | ||
name: 'Release' | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: {} | ||
jobs: | ||
release-please: | ||
permissions: | ||
contents: write # to create release commit (google-github-actions/release-please-action) | ||
pull-requests: write # to create release PR (google-github-actions/release-please-action) | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: google-github-actions/release-please-action@v3 | ||
id: release | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
command: github-release | ||
release-type: node | ||
package-name: nepali-datetime | ||
|
||
# The logic below handles the npm publication: | ||
- uses: actions/checkout@v2 | ||
# these if statements ensure that a publication only occurs when | ||
# a new release is created: | ||
if: ${{ steps.release.outputs.release_created }} | ||
|
||
- name: Setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
registry-url: 'https://registry.npmjs.org' | ||
if: ${{ steps.release.outputs.release_created }} | ||
|
||
- name: Install Dependencies | ||
run: npm ci | ||
if: ${{ steps.release.outputs.release_created }} | ||
|
||
- name: Build | ||
run: npm run build | ||
if: ${{ steps.release.outputs.release_created }} | ||
|
||
- name: Publish to NPM | ||
run: npm publish --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | ||
if: ${{ steps.release.outputs.release_created }} |
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