Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added publish workflow and PR template #11

Merged
merged 4 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
- Fixes #issue-number

**Description**

#### Checklist

- [ ] I have made corresponding changes to the documentation.
- [ ] I have verified the functionality in some of the neeto web-apps.
anmol-kumar0815 marked this conversation as resolved.
Show resolved Hide resolved
- [ ] I have added the necessary label (patch/minor/major - If package publish
is required).

**Reviewers**

<!---
------------- NOTES -------------
1. Do not add a patch/minor/major label if a release is not required.
2. Strike through the points ~~like this~~ if not applicable.
--->
8 changes: 8 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name-template: "v$RESOLVED_VERSION"
tag-template: "v$RESOLVED_VERSION"
template: |
## What's Changed
$CHANGES


**Full Changelog**: https://github.com/bigbinary/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
15 changes: 15 additions & 0 deletions .github/workflows/auto_update_prs_with_latest_main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: PR-autoupdate-from-main

on:
push:
branches:
- main

jobs:
Auto:
name: Auto-update
runs-on: ubuntu-latest
steps:
- uses: bigbinary/pr-auto-update@v2.1.6
with:
github_token: ${{ secrets.AUTOREBASE_TOKEN }}
80 changes: 80 additions & 0 deletions .github/workflows/create_and_publish_releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: "Create and publish releases"
on:
pull_request:
branches:
- main
types: [closed]
jobs:
release:
name: "Create Release"
runs-on: ubuntu-latest
if: >-
${{ github.event.pull_request.merged == true && (
contains(github.event.pull_request.labels.*.name, 'patch') ||
contains(github.event.pull_request.labels.*.name, 'minor') ||
contains(github.event.pull_request.labels.*.name, 'major') ) }}
steps:
- name: Checkout the repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8

- name: Setup git user
run: |
git config user.name "Anmol Kumar"
git config user.email "anmol.kumar@bigbinary.com"
- name: Setup NodeJS LTS version
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
with:
node-version-file: '.nvmrc'

- name: Setup the project
run: yarn install

- name: Generate production build
run: yarn build

- name: Prefix version tag with "v"
run: yarn config set version-tag-prefix "v"

- name: Disable Git commit hooks
run: git config core.hooksPath /dev/null

- name: Bump the patch version and create git tag on release
if: ${{ contains(github.event.pull_request.labels.*.name, 'patch') }}
run: yarn version --patch

- name: Bump the minor version and create git tag on release
if: ${{ contains(github.event.pull_request.labels.*.name, 'minor') }}
run: yarn version --minor

- name: Bump the major version and create git tag on release
if: ${{ contains(github.event.pull_request.labels.*.name, 'major') }}
run: yarn version --major

- name: Get the package version from package.json
uses: tyankatsu0105/read-package-version-actions@5aad2bb630a577ee4255546eb3ee0593df68f6ca
id: package-version

- name: Create a new version release commit
uses: EndBug/add-and-commit@050a66787244b10a4874a2a5f682130263edc192
with:
message: "New version release"

- name: Push the commit to main
uses: ad-m/github-push-action@492de9080c3179a3187bd456763f988f9a06e196
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main

- name: Create a release draft on release
uses: release-drafter/release-drafter@ac463ffd9cc4c6ad5682af93dc3e3591c4657ee3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: v${{ steps.package-version.outputs.version }}
publish: true

- name: Publish the package on NPM
uses: JS-DevTools/npm-publish@22595ff8c4d0d9f53cef0656fbb90fbe06ee885c
with:
access: "public"
token: ${{ secrets.NPM_TOKEN }}
29 changes: 29 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Publish to npm

on:
release:
types: [created]

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3

- name: Setup NodeJS LTS version
uses: actions/setup-node@v3
with:
node-version: "18.12.0"

- name: Setup the project
run: yarn install

- name: Generate production build
run: yarn build

- name: Publish the package on NPM
uses: JS-DevTools/npm-publish@v1
with:
access: "public"
token: ${{ secrets.NPM_TOKEN }}