Skip to content

Merge pull request #1 from sota1235/feat-to-ts #1

Merge pull request #1 from sota1235/feat-to-ts

Merge pull request #1 from sota1235/feat-to-ts #1

Workflow file for this run

name: Publishing to npm
on:
push:
branches:
- main
tags:
- "!*"
paths:
- 'package.json'
jobs:
check-version:
name: Checking whether it can be published or not
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setting up Node.js
uses: actions/setup-node@v3
with:
node-version-file: .node-version
registry-url: 'https://registry.npmjs.org'
cache: npm
- name: Executing can-npm-publish
run: npx can-npm-publish --verbose
release:
name: Releasing
needs: check-version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setting up Node.js
uses: actions/setup-node@v3
with:
node-version-file: .node-version
registry-url: 'https://registry.npmjs.org'
cache: npm
- name: Installing dependencies
run: |
npm ci
- name: Extract package-version
uses: actions/github-script@v6
id: extract-version
with:
script: |
const package = require('./package.json');
const version = package.version;
core.setOutput('version', version);
- name: package-version-to-git-tag
uses: pkgdeps/git-tag-action@00821b688297ad5792cf50e6aaa0d4404bec49d0 # v2.0.6
with:
github_token: ${{ github.token }}
github_repo: ${{ github.repository }}
version: ${{ steps.extract-version.outputs.version }}
git_commit_sha: ${{ github.sha }}
git_tag_prefix: "v"
- name: Build package
run: npm run build:publish
- name: Publishing to npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}