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

Add Documentation and Automate SDK Releases [release] 2.0.16 #342

Merged
merged 3 commits into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
Binary file added .DS_Store
Binary file not shown.
23 changes: 23 additions & 0 deletions .github/workflows/NPM_Publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "NPM Publish"

on:
release:
types: [published]

jobs:
release:
name: NPM Publish
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/[email protected]
- name: node
uses: actions/[email protected]
with:
node-version: 12
registry-url: https://registry.npmjs.org
- name: publish
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_ACCESS_TOKEN}}

34 changes: 34 additions & 0 deletions .github/workflows/Ruby_Gem_Publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Ruby Gem Publish"

on:
release:
types: [published]

jobs:
release:
permissions: write-all
runs-on: ubuntu-latest
steps:
# Checkout code if release was created
- uses: actions/[email protected]
# Setup ruby if a release was created
- uses: ruby/[email protected]
with:
# Not needed with a .ruby-version file
ruby-version: 2.7
# runs 'bundle install' and caches installed gems automatically
bundler-cache: true
# Publish
- name: publish gem
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
gem build *.gemspec
gem push *.gem
env:
# Make sure to update the secret name
# if yours isn't named RUBYGEMS_AUTH_TOKEN
GEM_HOST_API_KEY: "${{secrets.IFSC_GEM_ACCESS_TOKEN}}"

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [UNRELEASED][unreleased]

## [2.0.16][2.0.16]
### Changed
- Metadata updates
- Automated SDK Releases
- Added Documentation

## [2.0.14][2.0.14]
### Changed
- Metadata updates
Expand Down
70 changes: 70 additions & 0 deletions DOCUMENTATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
## Check whether a new release is required
1. Whenever a change in detected on the RBI website (https://rbi.org.in/), an automated email from the "RBI Updates" is sent on the "#tech_ifsc" Slack channel.
2. Open the website it has detected change and check the RBI release date to see if a new release is needed.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What to check to identify whether new release is required?

3. If the RBI lists are updated, make a new release.

## Publish a new release of IFSC repository (https://github.com/razorpay/ifsc)
1. Clone the IFSC repository (https://github.com/razorpay/ifsc) locally.
2. Create a new `release/{version}` branch. The branch name must be `release/x.y.z`. Start with a patch version bump unless you are making code level changes, in which case you can use a minor/major version bump.
3. Grep for the current version in the codebase. Bump the versions in `package.json`, `ifsc.gemspec`. Do not change it in `package-lock.json`.
4. Update `CHANGELOG.md` with the appropriate description.
5. Commit this as `[release] x.y.z`. Push these changes to the IFSC repository (https://github.com/razorpay/ifsc).
6. Github Actions are run automatically and under the "Scraper" Action, download the artifacts produced during runtime (`release-artifact` and `release-notes.md`) from the build pipeline. Make sure all the tests (Github Actions) are passing successfully.
7. Extract the artifacts and copy the files `banks.json`, `IFSC.json` and `sublet.json` into the `ifsc/src/` directory.
8. Again, commit these changes and push it into the IFSC repository and check the tests. If something is failing, you might need to edit the constants or `banknames.json` file.
9. Create a new pull request with this branch. Copy the `release-notes.md` file and use that as description for the PR. Review and merge the PR. Tag the merge commit (don't use a prefix, just `X.Y.Z`).
10. Push the tag to GitHub.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rewrite it as "Create a new release (Ref: link)"

  • Create new tag with pattern vx.y.z e.g. v2.0.14
  • Use release-notes.md file as the template
  • Replace TODO as applicable for the release.
  • Upload the release-artifact files as part of the release

11. Create a release on GitHub for the tag. Use `release-notes.md` file as the template. Replace `TODO` as applicable for the release. Upload the `release-artifact` files as part of the release.
12. On making a new release, Github Actions for SDK update are automatically triggered. After all the actions run successfully, the `npm`, `gem` and `php` packages are updated to the latest versions, which can be checked by the badges in the `README.md` file.

## Publish a new release of IFSC-API repository (https://github.com/razorpay/ifsc-api)
1. Ensure that a new gem release has been made for the latest release (https://rubygems.org/gems/ifsc).
2. Clone the IFSC-API repository (https://github.com/razorpay/ifsc-api) locally.
3. Create a new `{version}` branch. The branch name must be `x.y.z`. Start with a patch version bump unless you are making code level changes, in which case you can use a minor/major version bump.
4. Go to the latest IFSC release (https://github.com/razorpay/ifsc/releases).
5. Download and extract the `by-bank.tar.gz` file from the release assets and copy the files into the `ifsc-api/data` directory.
6. Run a dependency update (`bundle update && bundle update --gemfile Gemfile.build`).
7. Check whether the ifsc gem is updated to the latest version (`grep ifsc Gemfile.lock`).
8. Commit this as `[release] x.y.z`. Push these changes to the IFSC-API repository (https://github.com/razorpay/ifsc-api).
9. Create a new pull request with this branch. Review and merge the PR. Tag the merge commit (don't use a prefix, just `X.Y.Z`).
10. Push the tag to GitHub.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rewrite as discussed above

11. Create a release on GitHub for the tag. Add a description as applicable for the release.
12. Check whether a new tag has been created on docker hub (https://hub.docker.com/r/razorpay/ifsc/tags).

## Deploy the new IFSC release on X Dashboard / IFSC-API repository SDK update

1. Run `composer update razorpay/ifsc --ignore-platform-req=ext-grpc`.
```
composer update razorpay/ifsc --ignore-platform-req=ext-grpc
```
2. You will get to see something like this,
```
Your GitHub credentials are required to fetch private repository metadata ([email protected]:razorpay/hodor.git)
When working with _public_ GitHub repositories only, head to https://github.com/settings/tokens/new?scopes=&description=Composer+on+{...} to retrieve a token.
This token will have read-only permission for public information only.
When you need to access _private_ GitHub repositories as well, go to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+{...}
Note that such tokens have broad read/write permissions on your behalf, even if not needed by Composer.
Tokens will be stored in plain text in "/Users/{...}/.composer/auth.json" for future use by Composer.
For additional information, check https://getcomposer.org/doc/articles/authentication-for-private-packages.md#github-oauth
```
Go to the private repository token generation link and generate token.

3. Paste the token on terminal and press enter. You will get to see something like this,
```
Token stored successfully.
GitHub API token requires SSO authorization. Authorize this token at https://github.com/orgs/razorpay/sso?authorization_request={...}

After authorizing your token, confirm that you would like to retry the request
```
Go to the link to authorise.

4. Post authorising, just press `y` or write `yes` on terminal and press enter. It will update IFSC repository in API.
5. Commit the `composer.lock` file and raise PR. Fix any tests that fail due to the IFSC codes removed / added (need to let CI run and check required suites for failures, most of the ifsc tests are required only).
6. Merge and deploy.

## Deploy the new IFSC release on the API website (https://ifsc.razorpay.com/)
1. Go to Spinnaker (https://deploy.razorpay.com/#/applications/stage-ifsc/executions).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stage deployment

2. Run the "stage-ifsc-infra" pipeline, by clicking on "Start Manual Execution" against it. In the parameters section, enter the latest tag number as "2.0.14" (OR) simply "latest" against the "Image tag" parameter and enter the latest kube-manifest commit ID against the "kube_manifests_commit" parameter. Take the latest commit ID from kube-manifest repository (https://github.com/razorpay/kube-manifests).
3. Open the "stage-ifsc" endpoint (http://ifsc.stage.razorpay.in/) and test the API by running deleted and newly added IFSC codes in the latest release.
4. Run the "prod deploy" pipeline, by clicking on "Start Manual Execution" against it. In the parameters section, enter the latest tag number as "2.0.14" (OR) simply "latest" against the "Image tag" parameter.
5. Open the API (https://ifsc.razorpay.com/) and test the website by running deleted and newly added IFSC codes in the latest release.
2 changes: 1 addition & 1 deletion ifsc.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

Gem::Specification.new do |s|
s.name = 'ifsc'
s.version = '2.0.14'
s.version = '2.0.16'
s.date = '2022-10-28'
s.summary = 'IFSC code database to help you validate IFSC codes'
s.description = 'A simple gem by @razorpay to help you validate your IFSC codes. IFSC codes are bank codes within India'
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ifsc",
"version": "2.0.14",
"version": "2.0.16",
"description": "This is part of the IFSC toolset released by Razorpay. You can find more details about the entire release at [ifsc.razorpay.com](https://ifsc.razorpay.com). Includes only a validation library as of now.",
"main": "src/node/index.js",
"directories": {
Expand Down
2 changes: 1 addition & 1 deletion src/IFSC.json

Large diffs are not rendered by default.

Loading