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
34 changes: 34 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish to npm

on:
release:
types: [published]

permissions:
contents: read
id-token: write

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
with:
run_install: false

- uses: actions/setup-node@v4
with:
node-version: 22.14
registry-url: https://registry.npmjs.org
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build create-siemens-web
run: pnpm --filter create-siemens-web build

- name: Publish to npm
run: pnpm --filter create-siemens-web publish --no-git-checks --access public
24 changes: 24 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Release Please

on:
push:
branches: [main]
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs['packages/create-siemens-web--release_created'] }}
tag_name: ${{ steps.release.outputs['packages/create-siemens-web--tag_name'] }}
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
config-file: .release-please-config.json
manifest-file: .release-please-manifest.json
15 changes: 15 additions & 0 deletions .release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"release-type": "node",
"packages": {
"packages/create-siemens-web": {
"release-type": "node",
"package-name": "create-siemens-web",
"changelog-path": "CHANGELOG.md",
"bump-minor-pre-major": false,
"bump-patch-for-minor-pre-major": false,
"draft": false,
"prerelease": false
}
}
}
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"packages/create-siemens-web": "0.0.1"
}
74 changes: 74 additions & 0 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Developer Guide

## Releasing `create-siemens-web`

Releases are automated with [Release Please](https://github.com/googleapis/release-please).
It creates a release pull request from conventional commits merged into `main`.
Merging that pull request creates the Git tag and GitHub Release, then publishes the
package to npm with trusted publishing.

### One-time maintainer setup

Complete these steps before the first release:

1. Ensure `create-siemens-web` exists on npm. If the package does not yet exist, an
npm owner must claim the package name first.
2. In the package's npm settings, configure **Trusted Publishing** for GitHub Actions:
- Organization or user: `siemens`
- Repository: `ix-starter`
- Workflow filename: `publish.yml`
- Environment name: leave blank, unless the repository uses a GitHub Environment
as an additional release gate.
3. Install the [Release Please GitHub App](https://github.com/apps/release-please)
for this repository and add its token as the `RELEASE_PLEASE_TOKEN` repository
secret. The token needs permission to create pull requests, tags, and releases.

`RELEASE_PLEASE_TOKEN` is required instead of `GITHUB_TOKEN`: GitHub does not start
the `Publish to npm` workflow for a release event created with `GITHUB_TOKEN`.

### Prepare a release

1. Use [Conventional Commits](https://www.conventionalcommits.org/) in pull request
titles and squash-merge commit messages. The merge commit is what Release Please
reads after it reaches `main`.
2. Use `fix:` for a patch release, `feat:` for a minor release, and `feat!:` or a
`BREAKING CHANGE:` footer for a major release.
3. Merge the change into `main`. The **Release Please** workflow opens or updates a
release pull request for `create-siemens-web`.
4. Review the generated release pull request. Confirm the package version,
`CHANGELOG.md`, and `.release-please-manifest.json` are correct, and let the
standard pull request checks complete.

Commits such as `chore:`, `docs:`, `refactor:`, and `build:` do not create or update
a release pull request by themselves.

### Publish the release

1. Merge the reviewed Release Please pull request into `main`.
2. Confirm that the **Release Please** workflow created the `vX.Y.Z` tag and GitHub
Release.
3. Confirm that the **Publish to npm** workflow completed successfully. It installs
dependencies, builds `create-siemens-web`, and publishes the release through npm
OIDC trusted publishing.
4. Verify the published version with:

```sh
npm view create-siemens-web version
```

### Recover from failures

- If the release pull request is incorrect, fix the relevant conventional commits or
configuration on `main`. Release Please updates the same pull request on its next
run. Do not manually edit a version or create a tag.
- If the Release Please workflow fails, resolve its reported permission or
configuration error and rerun the workflow from GitHub Actions.
- If npm publishing fails after a GitHub Release is created, resolve the npm trusted
publisher or build error and rerun the failed **Publish to npm** workflow. Do not
create another GitHub Release or run `npm publish` locally.

### References

- [Release Please documentation](https://github.com/googleapis/release-please)
- [npm trusted publishing documentation](https://docs.npmjs.com/trusted-publishers)
- [GitHub Actions event triggering](https://docs.github.com/actions/how-tos/writing-workflows/choosing-when-your-workflow-runs/triggering-a-workflow)
Loading