Skip to content

bump JS-DevTools/npm-publish to v2 #65

bump JS-DevTools/npm-publish to v2

bump JS-DevTools/npm-publish to v2 #65

Workflow file for this run

name: Publish
on:
pull_request:
paths:
- "index*.ts"
- "test/**"
- ".github/workflows/publish.yml"
- "package.json"
workflow_dispatch:
push:
branches:
- main
paths:
- "index.ts"
- "README.md"
- ".github/workflows/publish.yml"
- "package.json"
tags:
- "v*"
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
TAG_BRANCH: ${{ env.TAG_BRANCH }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: get-tag-branch
run: bash .github/scripts/tag_ref.sh ${{ github.ref }}
- run: echo "${{ toJSON(env) }}"
test:
name: test on Node.js ${{ matrix.node-version }}
runs-on: ubuntu-latest
needs: prepare
strategy:
fail-fast: true
matrix:
node-version:
- 16
- 18
- 20
steps:
- uses: actions/checkout@v3
- name: Set Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v3
id: cache-deps
with:
path: |
**/node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: install dependencies
uses: borales/actions-yarn@v4
with:
cmd: install
- name: build package
uses: borales/actions-yarn@v4
with:
cmd: build
- name: build types
uses: borales/actions-yarn@v4
with:
cmd: tsc
- name: test types
uses: borales/actions-yarn@v4
with:
cmd: tsd
- name: test functionality
uses: borales/actions-yarn@v4
with:
cmd: test
- uses: actions/upload-artifact@v3
with:
name: lib
path: lib
publish:
name: Publish to npmjs
runs-on: ubuntu-latest
needs: [prepare, test]
if: ${{ needs.prepare.outputs.TAG_BRANCH == 'main' && startsWith(github.ref, 'refs/tags/v') }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "16.x"
- uses: actions/download-artifact@v3
with:
name: lib
path: lib
- uses: heinrichreimer/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
access: public
- uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
files: |
./lib/**
- uses: stefanzweifel/git-auto-commit-action@v4
with:
create_branch: true
branch: "changelog-${{ github.run_id }}"