Skip to content

Commit

Permalink
Merge pull request #64 from aj3sh/release-please-implementation
Browse files Browse the repository at this point in the history
Added release-please
  • Loading branch information
aj3sh authored Sep 24, 2023
2 parents b92505e + 479aab8 commit 954a123
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 7 deletions.
1 change: 0 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Please mark the appropriate option below to describe the type of change your pul
- [ ] I have used [semantic commit messages](https://seesparkbox.com/foundry/semantic_commit_messages).
Examples: `"fix: Fixed foobar bug"`, `"feat(accounts): Added foobar feature"`.
- [ ] I have added/updated the necessary documentation on `README.md`.
- [ ] I have updated `CHANGELOG.md` for the significant changes.
- [ ] I have added appropriate test cases (if applicable) to ensure the changes are functioning correctly.
- [ ] My pull request has a clear title and description.

Expand Down
9 changes: 4 additions & 5 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ The 'node-nepali-datetime' project is committed to maintaining the security and

We provide security updates and support for the latest stable release of the 'node-nepali-datetime' package. It is important to keep your software up to date to ensure you have the latest security patches.

| Version | Supported |
| ------- | ------------------ |
| 1.1.x | :white_check_mark: |
| 1.0.x | :white_check_mark: |
| 0.1.0 | :x: |
| Version | Supported |
| --------------- | ------------------ |
| 1.0.0 and above | :white_check_mark: |
| 0.1.0 | :x: |

## Reporting a Vulnerability

Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/release-pr.yml
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"}
]
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
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 }}
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Before submitting your Pull Request, please do the following steps:

1. Add any changes you want.
1. Add tests for the new changes.
1. Update the `CHANGELOG.md` file if necessary.
1. Edit documentation (`README.md`) if you have changed something significant.
1. Commit your changes using [semantic commit message](https://seesparkbox.com/foundry/semantic_commit_messages).
Examples: `"fix: Fixed foobar bug"`, `"feat(accounts): Added foobar feature on accounts"`.
Expand Down

0 comments on commit 954a123

Please sign in to comment.