Skip to content

Create Release

Create Release #5

name: "Create Release"
on:
workflow_dispatch:
inputs:
releaseType:
type: choice
description: Release Type
options:
- minor
- patch
- major
jobs:
publish:
name: "Build, Tag & Publish"
runs-on: ubuntu-latest
steps:
- name: "Checkout Code"
uses: actions/checkout@v3
with:
ref: main
- name: "Setup NodeJS Environment"
uses: actions/setup-node@v3
with:
node-version: 16
registry-url: "https://npm.pkg.github.com"
scope: "@hypoport"
- name: "Install Dependencies"
run: npm ci
- name: "Configure Git Author"
run: |
git config user.name "github-actions"
git config user.email "[email protected]"
- name: "Increase Version"
run: npm version ${{ inputs.releaseType }} --no-git-tag-version
- name: "Extract Version as Environment Variable"
run: |
echo "version=$(npx -c 'echo "$npm_package_version"')" >> $GITHUB_ENV
- name: "Build"
run: npm run release
- name: "Configure NPM-Package Write Credentials"
run: |
npm config set @hypoport:registry https://npm.pkg.github.com
npm config set //npm.pkg.github.com/:_authToken ${{ secrets.GITHUB_TOKEN }}
- name: "Create and Push Release"
run: |
git add .
git commit -m "increased version to ${{ env.version }}"
git tag v${{ env.version }}
git push
git push origin v${{ env.version }}
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}