This week my task was finally to put izyum live and make it available for everybody. Considering the fact that I was using typescript for it's development I pushed it to the npm packages registry. It was a first time experience for me to push some tool to npm registry and I am about to say how it was.
Code preparation
The first thing I wanted to make sure that my package.json
file has everything it needs. I added several things like email to the author
field, also I had to move some packages to the user dependencies because they were needed in the run-time.
Continuous Delivery
After that I created the github action which I called cd
and it was doing surprise surprise - Continues Delivery. This action is triggered when I add the new tag to the main branch and it builds the app and pushes it to the npm registry. Action source looked like this:
name: cd
on:
push:
tags:
- 'v**'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .npmrc file to publish to npm
uses: actions/setup-node@v1
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- name: Install modules
run: npm install
- name: Build
run: npm run build
- name: Publish to npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
To be honest, nothing makes me more exited and inspired about software development as development automatisations. I just feels like magic every time 🪄
Versioning
NPM has pretty decent pre-built functionality for versioning your package, so I just used it to version my app. I created several minor and patch releases and when I was sure that everything works as expected I created the new major version which was 1.0.0
.
How to get Izyum
Izyum is now available in npm and you can download it to your project but just a simple and well-known command
npm install izyum -g
Top comments (0)