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:
# tag_name grouping - queues actual releases for the same tag
# run_id - fallback value required for group as tag_name might not always be present (manual triggers)
group: npm-publish-${{ github.event.release.tag_name || github.run_id }}
cancel-in-progress: false

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth a comment on why we want these settings here. While I agree with it for the tag_name case, the fallback to run_id seems odd so I want to make sure I understand the goal.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

group requires a value and I picked run_id as fallback when tag_name is not present - this can happen on manual triggers, dry run/testing purposes.


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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this do in this context? I don't think I have ever seen this be necessary, so just want to make sure I understand why it is here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This removes the github access token after the repo is cloned


- uses: actions/setup-node@v7
with:
node-version: 22.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/' pack.log
! grep -qE '[[:space:]]test/' pack.log
! grep -qE '[[:space:]]tools/' 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@v7
with:
node-version: 22.x
registry-url: https://registry.npmjs.org

- name: publish to npm
run: npm publish --provenance
16 changes: 16 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
on:
push:
branches:
- master
name: release-please
permissions:
contents: write
issues: write
pull-requests: write
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v5
with:
release-type: node
14 changes: 8 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ jobs:
node-version: [18, 20, 22]
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v7
- name: Setup Node.js
uses: actions/setup-node@v5
uses: actions/setup-node@v7
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: npm install
run: npm ci
- name: Test / Lint / Codestyle
run: make all
test-optional:
Expand All @@ -29,12 +29,14 @@ jobs:
node-version: [24]
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v7
- name: Setup Node.js
uses: actions/setup-node@v5
uses: actions/setup-node@v7
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: npm install
run: npm ci
continue-on-error: true
- name: Test / Lint / Codestyle
run: make all
continue-on-error: true
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Thumbs.db

/node_modules/
npm-debug.log
package-lock.json
yarn.lock

# build task results for ci
Expand Down
13 changes: 0 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ ESLINT := $(NODE_BIN)/eslint
ISTANBUL := $(NODE_BIN)/nyc
MOCHA := $(NODE_BIN)/mocha
_MOCHA := $(NODE_BIN)/_mocha
UNLEASH := $(NODE_BIN)/unleash
CONVENTIONAL_RECOMMENDED_BUMP := $(NODE_BIN)/conventional-recommended-bump


#
Expand Down Expand Up @@ -72,17 +70,6 @@ githooks: ## Install githooks
@ln -s $(GIT_HOOK_SRC) $(GIT_HOOK_DEST)


.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) ## Run lint and style checks
@$(ESLINT) $(ALL_FILES)
Expand Down
Loading
Loading