Skip to content

Commit e2e6827

Browse files
committed
feat: reusable workflows as default ci-cd
1 parent 4190424 commit e2e6827

File tree

1 file changed

+122
-0
lines changed

1 file changed

+122
-0
lines changed
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# Adopting shared & reusable GitHub Actions for publishing pipelines
2+
3+
## Summary
4+
5+
This RFC proposes standardizing all **publish and release automation** workflows across the Express.js organization using **shared, reusable GitHub Actions**. These workflows will handle packaging and secure publication to npm, ensuring consistent and reliable release processes across all repositories. This workflows will be centrally maintained, versioned, and consumed by individual repositories to ensure consistency, reliability, and easier maintenance.
6+
7+
## Motivation
8+
9+
Currently, each repository in the Express.js organization maintains its own GitHub Actions workflows. This leads to:
10+
11+
- Inconsistent CI/CD practices (different Node versions, test commands, caching, verification steps, etc.)
12+
- Duplicated effort across repositories
13+
- Increased probability of misconfiguration or security vulnerabilities
14+
- Difficulty onboarding new contributors and maintainers
15+
- Harder organization-wide upgrades (e.g., Node.js version updates or introducing new security validations)
16+
17+
By moving to shared reusable workflows, we expect to:
18+
19+
- Ensure consistent release standards across all repositories
20+
- Reduce maintenance overhead and simplify updates
21+
- Improve security by enforcing centralized best practices
22+
- Enable easier shared improvements for all repositories
23+
- Support future capabilities such as provenance and trusted publisher
24+
25+
## Detailed Explanation
26+
27+
### Proposal
28+
29+
- Create and maintain centralized reusable workflows under a repository such as:
30+
- `expressjs/ci-workflows` (repository name to be decided later)
31+
32+
- This repository will include:
33+
- `release.yml` — publish to npm and create GitHub releases (optional approval gates)
34+
35+
```yaml
36+
- uses: step-security/wait-for-secrets@v1
37+
id: wait-for-secrets
38+
with:
39+
secrets: |
40+
OTP:
41+
name: 'OTP to publish package'
42+
description: 'NPM 2FA'
43+
44+
- name: publish
45+
env:
46+
NPM_TOKEN: ${{ secrets.NPM_PUBLISH }}
47+
run: |
48+
npm publish --otp ${{ steps.wait-for-secrets.outputs.OTP }} --access public
49+
```
50+
51+
- Each repository will consume them using `workflow_call`, for example:
52+
53+
```yaml
54+
name: Publish package
55+
on:
56+
release:
57+
types: [released]
58+
59+
permissions:
60+
id-token: write
61+
contents: read
62+
63+
jobs:
64+
publish:
65+
uses: expressjs/ci-workflows/.github/workflows/release.yaml@v1
66+
secrets:
67+
NPM_PUBLISH: ${{ secrets.NPM_PUBLISH }}
68+
```
69+
70+
- Customization will still be possible using workflow inputs and conditionals.
71+
- Workflows will be versioned (`v1`, `v1.1`, etc.) to ensure stability and exact sha can be used.
72+
73+
### Migration
74+
75+
1. Create shared workflow repository and initial pipeline definitions.
76+
2. Document how to consume workflows, expected defaults, and available inputs.
77+
3. Migrate a few core repositories (`express`, `router`, `body-parser`) as a pilot.
78+
4. Expand adoption across the organization.
79+
5. Deprecate custom pipelines once migration is completed.
80+
81+
## Rationale and Alternatives
82+
83+
| Approach | Pros | Cons |
84+
|----------|------|------|
85+
| **Shared reusable workflows (proposed)** | Consistent CI/CD, easier maintenance, improved security, one update applies to all repos | Requires initial setup and governance |
86+
| **Status quo: per-repository workflows** | Maximum flexibility per repository | Inconsistent behavior, duplicated code, high maintenance, increased risk of outdated CI |
87+
88+
This proposal offers the best balance of maintainability, consistency, and openness for the Express.js ecosystem.
89+
90+
## Implementation
91+
92+
### Affected Areas
93+
94+
- All active repositories using GitHub Actions under the `expressjs/` organization.
95+
- All active repositories using GitHub Actions under the `pillarjs/` organization.
96+
- All active repositories using GitHub Actions under the `jshttp/` organization.
97+
- No runtime code changes required; only CI configuration updates.
98+
99+
### Actions Required
100+
101+
- Create new organization repository.
102+
- Implement and document reusable workflows.
103+
- Configure organization-wide secrets (npm token, GitHub token, etc.) if required.
104+
- Roll out reusable workflows in prioritized repositories.
105+
- Establish contribution guidelines and versioning strategy for workflow updates.
106+
107+
### Technical Considerations
108+
109+
- Use `workflow_call` and workflow permissions properly.
110+
- Use only organization-level secrets, not per-repo secrets for shared steps.
111+
- Release workflows should include safeguards (e.g., manual approval for npm publish).
112+
113+
## Prior Art
114+
115+
- GitHub officially recommends this pattern for large organizations.
116+
117+
## Unresolved Questions and Bikeshedding
118+
119+
- What should the shared workflow repository be named?
120+
- Should `npm audit` or CodeQL scanning be mandatory by default?
121+
- How should versions of workflows be managed - tagged releases (`v1`) or branch references (`main`)?
122+
- Should automatic npm releases be allowed, or manual approvals required?

0 commit comments

Comments
 (0)