Skip to content

chore(actions): add github actions #1

chore(actions): add github actions

chore(actions): add github actions #1

Workflow file for this run

# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
name: Publish
on:
workflow_dispatch:
inputs:
version:
description: Release type
required: false
type: choice
default: patch
options:
- patch
- minor
- major
release:
types: [created]
jobs:
build:
uses: ./build.yml

Check failure on line 23 in .github/workflows/release.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/release.yml

Invalid workflow file

invalid value workflow reference: no version specified
version:
needs: build
runs-on: ubuntu-latest
name: Update version in package.json
steps:
- uses: actions/checkout@v4
- name: Show version
run: cat ./package.json | grep version
- name: Bump version (patch)
uses: KageKirin/[email protected]
with:
major: ${{ github.event.inputs.version }} == major
minor: ${{ github.event.inputs.version }} == minor
patch: ${{ github.event.inputs.version }} == patch
- name: Show updated version
run: cat ./package.json | grep version
- name: Commit new version
run: |
git commit -am "ci(version): bump version to ${{ steps.test.package_version.version }}"
git tag -m "ci(version): create new tag" v${{ steps.test.package_version.version }}
git push --follow-tags https://${{ github.token }}@github.com/${{ github.repository }}
publish-npm:
needs: version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}