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
11 changes: 7 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ jobs:
node-version: 20
registry-url: https://registry.npmjs.org

# Ensure npm 11.5.1 or later is installed
- name: Update npm
run: npm install -g npm@latest

- run: npm ci

- run: npm test
Expand All @@ -60,10 +64,9 @@ jobs:
exit 1
fi

- name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# Use the Trusted Publishing feature to publish the package
# https://docs.npmjs.com/trusted-publishers
- run: npm publish

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
Expand Down
43 changes: 33 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,53 @@ Proposals].

### Dependencies

The Spectral Ruleset requires Node version 20 or later.
The Spectral Ruleset requires:

### Install Spectral
- Node version 20 or later.
- The [@stoplight/spectral-cli] npm package.

`npm i @stoplight/spectral-cli -g`
[@stoplight/spectral-cli]:
https://www.npmjs.com/package/@stoplight/spectral-cli

### Installation

You can use the aep-openapi-linter as an npm package or directly from GitHub.

If you choose to use it as an npm package, install it in your project as you
would any other npm package:

```sh
npm install @aep_dev/aep-openapi-linter
```

### Usage

You can specify the ruleset directly on the command line:
To use the aep-openapi-linter, create a Spectral configuration file
(`.spectral.yaml`) that references the ruleset. If you installed the
aep-openapi-linter npm package into your project, you can just reference the
ruleset by name:

`spectral lint -r https://raw.githubusercontent.com/aep-dev/aep-openapi-linter/main/spectral.yaml <api definition file>`
```yaml
extends:
- '@aep_dev/aep-openapi-linter'
```

Note that the quotes are required by yaml syntax.

Or you can create a Spectral configuration file (`.spectral.yaml`) that
references the ruleset:
You can also bypass installing the npm aep-openapi-linter package and reference
the ruleset directly from GitHub:

```yaml
extends:
- https://raw.githubusercontent.com/aep-dev/aep-openapi-linter/main/spectral.yaml
```

### Example
You can pin to a specific release of the ruleset by replacing `main` with the
tag for the release. E.g.

```bash
spectral lint -r https://raw.githubusercontent.com/aep-dev/aep-openapi-linter/main/spectral.yaml petstore.yaml
```yaml
extends:
- https://raw.githubusercontent.com/aep-dev/aep-openapi-linter/refs/tags/v0.5.1/spectral.yaml
```

### Using the Spectral VSCode extension
Expand Down
10 changes: 5 additions & 5 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ modifies "package json'. When triggered, it
2. Install dependencies and run the tests. These should never fail since PRs
targeting main must pass CI, but this is an extra precaution.
3. Create and push a git tag matching the version in package.json
4. Publish the package to npm
4. Publish the package to npm, using the new
[Trusted publishing](https://docs.npmjs.com/trusted-publishers) feature of
npm.
5. Create a GitHub Release with auto-generated notes

This single workflow handles the entire release process and ensures the npm and
Expand All @@ -86,10 +88,8 @@ GitHub.

## npm Configuration

Publishing requires:

- An npm automation token stored as a GitHub secret named `NPM_TOKEN`
- `publishConfig.access` set appropriately in `package.json`
Publishing requires that the GitHub action is registered as a trusted publisher
for the package on npm.

## Optional: Changelog

Expand Down
32 changes: 29 additions & 3 deletions scripts/prepare-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,32 @@ echo "✓ Release branch created and pushed!"
echo " Branch: $BRANCH_NAME"
echo " Version: v$NEW_VERSION"
echo ""
echo "Next steps:"
echo " 1. Create a Pull Request to merge $BRANCH_NAME into main"
echo " 2. Once merged, the tag will be created automatically"

# Check if gh CLI is installed
if command -v gh &> /dev/null; then
echo "Creating Pull Request..."

PR_TITLE="Release v$NEW_VERSION"
PR_BODY="This PR bumps the package version to v$NEW_VERSION.

Once merged, the release workflow will automatically create a git tag and publish the package to npm.

**Version Type:** $VERSION_TYPE"

gh pr create \
--base main \
--head "$BRANCH_NAME" \
--title "$PR_TITLE" \
--body "$PR_BODY"

echo "✓ Pull Request created successfully!"
else
echo "Note: GitHub CLI (gh) not found. Skipping automatic PR creation."
echo ""
echo "Next steps:"
echo " 1. Create a Pull Request to merge $BRANCH_NAME into main"
echo " 2. Once merged, the tag will be created automatically"
echo ""
echo "To enable automatic PR creation, install the GitHub CLI:"
echo " https://cli.github.com/"
fi