feat: add GitHub Actions workflows for code quality and automation (#2)

This commit is contained in:
2025-02-02 00:42:19 +02:00
committed by GitHub
parent af6ecdf6ca
commit 210aa969b3
105 changed files with 8807 additions and 408 deletions

57
npm-publish/action.yml Normal file
View File

@@ -0,0 +1,57 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/github-action.json
name: Publish to NPM
description: 'Publishes the package to the NPM registry with configurable scope and registry URL.'
author: 'Ismo Vuorinen'
branding:
icon: package
color: green
inputs:
registry-url:
description: 'Registry URL for publishing.'
required: false
default: 'https://registry.npmjs.org/'
scope:
description: 'Package scope to use.'
required: false
default: '@ivuorinen'
package-version:
description: 'The version to publish.'
required: false
default: ${{ github.event.release.tag_name }}
runs:
using: composite
steps:
- name: Setup Node.js
uses: ivuorinen/actions/node-setup@main
- name: Authenticate NPM
shell: bash
run: |
echo "//${{ inputs.registry-url }}/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
- name: Publish Package
shell: bash
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
pkg_version=$(node -p "require('./package.json').version")
if [ "$pkg_version" != "${{ inputs.package-version }}" ]; then
echo "Version mismatch: package.json ($pkg_version) != input (${{ inputs.package-version }})"
exit 1
fi
# Dry run first
npm publish \
--registry ${{ inputs.registry-url }} \
--dry-run \
--scope ${{ inputs.scope }}
npm publish \
--registry ${{ inputs.registry-url }} \
--verbose \
--scope ${{ inputs.scope }} \
--tag ${{ inputs.package-version }}