Skip to content

Commit

Permalink
Added workflow for release
Browse files Browse the repository at this point in the history
  • Loading branch information
sikrinick committed Sep 10, 2023
1 parent dec0ec9 commit ac82218
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Release
on:
workflow_dispatch:
inputs:
release-type:
description: "Release type"
required: true
default: "patch"
type: choice
options:
- patch
- minor
- major
- prepatch
- preminor
- premajor
- prerelease

env:
node_version: 18

concurrency:
group: release
cancel-in-progress: true

permissions: write-all

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

- name: Setup Node.js ${{ env.node_version }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.node_version }}
# setting a registry enables the NODE_AUTH_TOKEN env variable where we can set a npm token. REQUIRED
registry-url: 'https://registry.npmjs.org'

- name: Prepare modules
run: npm ci

- name: Run tests
run: npm test

- name: Setup Git
run: |
git config --global user.email "sikrinick@gmail.com"
git config --global user.name "${{ github.actor }}"
- name: Increment package version and add tag
run: npm version ${{ github.event.inputs.release-type }}

- name: Release Tag
id: release-tag-retriever
run: echo "release-tag=$(git describe --tags)" >> $GITHUB_OUTPUT

- name: Push commit and tag
run: git push --follow-tags

- name: Publish to NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Print Release tag
run: echo ${{ steps.release-tag-retreiver.outputs.release-tag }}
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.github
.idea
*.iml

0 comments on commit ac82218

Please sign in to comment.