Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: npm-publish

on:
release:
types: [published]
workflow_dispatch:

permissions:
contents: read

concurrency:
group: npm-publish-${{ github.event.release.tag_name || github.run_id }}
cancel-in-progress: false

jobs:
validate:
name: Validate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event.release.tag_name || github.ref }}
persist-credentials: false

- uses: actions/setup-node@v6
with:
node-version: 26.x

- name: verify release version
if: github.event_name == 'release'
run: |
pkg_name=$(jq -r .name package.json)
pkg_version=$(jq -r .version package.json)
tag_version="${GITHUB_EVENT_RELEASE_TAG_NAME#v}"
if [ "$pkg_version" != "$tag_version" ]; then
echo "package.json version ($pkg_version) does not match release tag ($tag_version)"
exit 1
fi
if npm view "${pkg_name}@${pkg_version}" version >/dev/null 2>&1; then
echo "${pkg_name}@${pkg_version} is already published"
exit 1
fi
env:
GITHUB_EVENT_RELEASE_TAG_NAME: ${{ github.event.release.tag_name }}

- name: validate publish package contents
run: |
npm pack --dry-run 2>&1 | tee pack.log
grep -q 'lib/index.js' pack.log
grep -q 'lib/index.d.ts' pack.log
! grep -qE '[[:space:]]test/' pack.log
! grep -qE '[[:space:]]tools/' pack.log
! grep -qE '[[:space:]]scripts/' pack.log

publish:
name: publish
needs: validate
if: github.event_name == 'release'
runs-on: ubuntu-latest
environment: Publish
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event.release.tag_name }}
persist-credentials: false

- uses: actions/setup-node@v6
with:
node-version: 26.x
registry-url: https://registry.npmjs.org

- name: publish to npm
run: npm publish --provenance --access public
17 changes: 17 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
on:
push:
branches:
- master
permissions:
contents: write
issues: write
pull-requests: write
name: release-please
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: node
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Thumbs.db
/node_modules/
npm-debug.log
yarn.lock
package-lock.json

# VIM viles #
#############
Expand Down
13 changes: 0 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ ESLINT := $(NODE_BIN)/eslint
MOCHA := $(NODE_BIN)/mocha
NYC := $(NODE_BIN)/nyc
PRETTIER := $(NODE_BIN)/prettier
UNLEASH := $(NODE_BIN)/unleash
CONVENTIONAL_RECOMMENDED_BUMP := $(NODE_BIN)/conventional-recommended-bump
COVERAGE_BADGE := $(TOOLS)/coverageBadge.js


Expand Down Expand Up @@ -83,17 +81,6 @@ githooks: $(GITHOOKS) ## Symlink githooks
)


.PHONY: release-dry
release-dry: $(NODE_MODULES) ## Dry run of `release` target
$(UNLEASH) -d --type=$(shell $(CONVENTIONAL_RECOMMENDED_BUMP) -p angular)


.PHONY: release
release: $(NODE_MODULES) ## Versions, tags, and updates changelog based on commit messages
$(UNLEASH) --type=$(shell $(CONVENTIONAL_RECOMMENDED_BUMP) -p angular) --no-publish
$(NPM) publish


.PHONY: lint
lint: $(NODE_MODULES) $(ESLINT) $(ALL_FILES) ## Run lint checker (eslint).
@$(ESLINT) $(ALL_FILES)
Expand Down
Loading