Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .changeset/fast-drinks-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@adobe/aio-lib-telemetry": patch
---

Fixes the `export` paths for ESM which were pointing to wrong files
132 changes: 132 additions & 0 deletions .github/workflows/deprecate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: Deprecate Package

on:
workflow_dispatch:
inputs:
version:
description: 'Version to deprecate (e.g., 1.0.0 or @adobe/aio-lib-telemetry@1.0.0)'
required: true
type: string

message:
description: 'Deprecation message'
required: true
type: string
default: 'This version has been deprecated. Please upgrade to the latest version.'

unpublish:
description: 'Also unpublish the version (WARNING: Irreversible and discouraged by npm)'
required: false
type: boolean
default: false

dry_run:
description: 'Dry run (simulate without making actual changes)'
required: false
type: boolean
default: false

jobs:
deprecate:
name: Deprecate Package Version
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
registry-url: 'https://registry.npmjs.org'

- name: Validate and normalize version
id: version
run: |
echo "Version input: ${{ inputs.version }}"
echo "Message: ${{ inputs.message }}"
echo "Also unpublish: ${{ inputs.unpublish }}"
echo "Dry run: ${{ inputs.dry_run }}"

VERSION="${{ inputs.version }}"

# Validate version format (major.minor.patch only)
# Regex source: Simplified semantic versioning pattern matching X.Y.Z format
# Reference: https://semver.org/ (basic version core: MAJOR.MINOR.PATCH)
if [[ "$VERSION" =~ ^(@[a-z0-9-]+/[a-z0-9-]+@)?[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
# Valid format
if [[ "$VERSION" =~ ^@.+/.+@ ]]; then
# Already has package name
VALIDATED_VERSION="$VERSION"
else
# Add package name
VALIDATED_VERSION="@adobe/aio-lib-telemetry@$VERSION"
fi
else
echo "::error::Invalid version format. Expected: 'X.Y.Z' (e.g., '1.0.0') or '@adobe/aio-lib-telemetry@X.Y.Z'"
echo "::error::Pre-release versions and build metadata are not supported."
exit 1
fi

echo "Validated version: $VALIDATED_VERSION"
echo "VALIDATED_VERSION=$VALIDATED_VERSION" >> "$GITHUB_OUTPUT"

- name: Deprecate package version
run: |
VERSION="${{ steps.version.outputs.VALIDATED_VERSION }}"

if [[ "${{ inputs.dry_run }}" == "true" ]]; then
echo "🔍 DRY RUN: Would deprecate: $VERSION"
echo "🔍 DRY RUN: With message: ${{ inputs.message }}"
else
echo "Deprecating: $VERSION"
npm deprecate "$VERSION" "${{ inputs.message }}"
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.ADOBE_BOT_NPM_TOKEN }}

- name: Unpublish package version
if: ${{ inputs.unpublish }}
run: |
VERSION="${{ steps.version.outputs.VALIDATED_VERSION }}"

if [[ "${{ inputs.dry_run }}" == "true" ]]; then
echo "🔍 DRY RUN: Would unpublish: $VERSION"
echo "⚠️ WARNING: This action would be irreversible and is discouraged by npm."
echo "This action is irreversible and discouraged by npm."
echo "Consider using deprecate instead."
else
echo "Unpublishing: $VERSION"
npm unpublish "$VERSION"
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.ADOBE_BOT_NPM_TOKEN }}

- name: Verify action
run: |
VERSION="${{ steps.version.outputs.VALIDATED_VERSION }}"

# Extract just the version number
VERSION_NUM="${VERSION##*@}"

if [[ "${{ inputs.dry_run }}" == "true" ]]; then
echo "🔍 DRY RUN completed successfully - no actual changes were made"
echo "Would have deprecated version $VERSION_NUM"
echo "📝 With message: ${{ inputs.message }}"

if [[ "${{ inputs.unpublish }}" == "true" ]]; then
echo "Would have also unpublished version $VERSION_NUM"
fi
else
echo "Action completed successfully"
echo "✅ Version $VERSION_NUM has been deprecated"
echo "📝 Message: ${{ inputs.message }}"

if [[ "${{ inputs.unpublish }}" == "true" ]]; then
echo "✅ Version $VERSION_NUM has also been unpublished"
fi
fi

45 changes: 5 additions & 40 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
- name: Run Knip
run: npx knip

code-quality:
name: Check Code Quality (Node ${{ matrix.node-version }})
check-build-test:
name: Check, Build, Test, and Publint (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
# We want to run checks on all versions, even if some fail.
Expand All @@ -56,46 +56,11 @@ jobs:
- name: Check types
run: npm run typecheck

build:
name: Build (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Previous LTS (Maintenance), Current LTS, Latest stable
node-version: [20, 22, 24]

steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Setup environment
uses: ./.github/actions/setup-ci-env
with:
install-deps: true
node-version: ${{ matrix.node-version }}

- name: Run Build
run: npm run build

test:
name: Test (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Previous LTS (Maintenance), Current LTS, Latest stable
node-version: [20, 22, 24]

steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Setup environment
uses: ./.github/actions/setup-ci-env
with:
install-deps: true
node-version: ${{ matrix.node-version }}

- name: Run Tests
run: npm run test

- name: Run Publint
run: npm run publint
30 changes: 15 additions & 15 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.ADOBE_BOT_NPM_TOKEN }}

- name: Generate Slack Announcement
id: announcement
if: steps.changesets.outputs.published == 'true'
run: |
# From Node v22.18.0, the node command is able to run .ts files directly (if it only needs type stripping).
# As of August 2025, Node v22.18.0 is already LTS (the version used by this workflow).
SLACK_WEBHOOK_PAYLOAD="$(node .github/scripts/announce.ts '${{ steps.changesets.outputs.publishedPackages }}')"
echo "SLACK_WEBHOOK_PAYLOAD=$SLACK_WEBHOOK_PAYLOAD" >> "$GITHUB_OUTPUT"
# - name: Generate Slack Announcement
# id: announcement
# if: steps.changesets.outputs.published == 'true'
# run: |
# # From Node v22.18.0, the node command is able to run .ts files directly (if it only needs type stripping).
# # As of August 2025, Node v22.18.0 is already LTS (the version used by this workflow).
# SLACK_WEBHOOK_PAYLOAD="$(node .github/scripts/announce.ts '${{ steps.changesets.outputs.publishedPackages }}')"
# echo "SLACK_WEBHOOK_PAYLOAD=$SLACK_WEBHOOK_PAYLOAD" >> "$GITHUB_OUTPUT"

- name: Notify on Slack
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
if: steps.changesets.outputs.published == 'true'
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
webhook-type: incoming-webhook
payload: ${{ steps.announcement.outputs.SLACK_WEBHOOK_PAYLOAD }}
# - name: Notify on Slack
# uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
# if: steps.changesets.outputs.published == 'true'
# with:
# webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
# webhook-type: incoming-webhook
# payload: ${{ steps.announcement.outputs.SLACK_WEBHOOK_PAYLOAD }}
2 changes: 1 addition & 1 deletion knip.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"project": ["**/*", "!docs"]
"project": ["**/*", "!docs", "!.github/scripts"]
}
61 changes: 59 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading