@ebalzan/ci 0.0.0-stage → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/bin/cli.mjs +101 -0
- package/commitlint.config.mjs +39 -0
- package/config/actions.env +28 -0
- package/config/repo-settings.json +12 -0
- package/config/rulesets/protect-dev.json +10 -0
- package/config/rulesets/protect-main.json +10 -0
- package/config/rulesets/require-pull-request.json +33 -0
- package/config/rulesets/require-release-pr.json +33 -0
- package/config/secrets.env.example +33 -0
- package/config/types.json +14 -0
- package/lib/config.mjs +182 -0
- package/lib/github.mjs +132 -0
- package/lib/log.mjs +34 -0
- package/lib/onboard.mjs +526 -0
- package/lib/sync.mjs +312 -0
- package/package.json +72 -4
- package/renovate/tooling.json +45 -0
- package/templates/.github/actions.env +21 -0
- package/templates/.github/workflows/auto-pr.yml +56 -0
- package/templates/.github/workflows/deploy.yml +88 -0
- package/templates/.github/workflows/pr-checks.yml +110 -0
- package/templates/.github/workflows/release.yml +76 -0
- package/templates/.husky/commit-msg +11 -0
- package/templates/eslint.config.mjs +6 -0
- package/templates/renovate.json +4 -0
- package/templates/secrets.gitignore +4 -0
- package/README.md +0 -3
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# PR Checks — the quality gate for every PR into dev or main.
|
|
3
|
+
#
|
|
4
|
+
# pr-check / Work PR __CI_REPO__'s pr-checks action for feat/fix/… PRs
|
|
5
|
+
# into dev — Conventional title and commits, then the
|
|
6
|
+
# PR's data: branch, title type, type label, assignee,
|
|
7
|
+
# author, milestone, board, description.
|
|
8
|
+
# pr-check / Release PR The same action for the dev → main PR — the same
|
|
9
|
+
# commitlint steps, the computed
|
|
10
|
+
# `<type>[!]: release vX.Y.Z` title, the `release`
|
|
11
|
+
# label, assignee, milestone, board, description.
|
|
12
|
+
#
|
|
13
|
+
# The other kind is skipped, as are drafts. Keep the two job names as they are:
|
|
14
|
+
# they are the check names the shared rulesets require.
|
|
15
|
+
#
|
|
16
|
+
# The PR's metadata is part of the check, so it also re-runs when the title,
|
|
17
|
+
# description, labels, milestone or assignees change.
|
|
18
|
+
# Add this repo's own build/test/lint jobs below; they run in parallel.
|
|
19
|
+
# Generated by `ebalzan-ci onboard`; the check logic lives in the action (it
|
|
20
|
+
# follows __CI_REF__).
|
|
21
|
+
# =============================================================================
|
|
22
|
+
name: PR Checks
|
|
23
|
+
|
|
24
|
+
on:
|
|
25
|
+
pull_request:
|
|
26
|
+
branches: ['main', 'dev']
|
|
27
|
+
types:
|
|
28
|
+
- opened
|
|
29
|
+
- synchronize
|
|
30
|
+
- reopened
|
|
31
|
+
- ready_for_review
|
|
32
|
+
- edited
|
|
33
|
+
- labeled
|
|
34
|
+
- unlabeled
|
|
35
|
+
- milestoned
|
|
36
|
+
- demilestoned
|
|
37
|
+
- assigned
|
|
38
|
+
- unassigned
|
|
39
|
+
|
|
40
|
+
permissions:
|
|
41
|
+
contents: read
|
|
42
|
+
pull-requests: write
|
|
43
|
+
|
|
44
|
+
concurrency:
|
|
45
|
+
group: pr-checks-${{ github.event.pull_request.number }}
|
|
46
|
+
cancel-in-progress: true
|
|
47
|
+
|
|
48
|
+
env:
|
|
49
|
+
AUTO_BASE_BRANCH: dev
|
|
50
|
+
AUTO_RELEASE_BRANCH: main
|
|
51
|
+
REPO_VARS_JSON: ${{ toJSON(vars) }}
|
|
52
|
+
|
|
53
|
+
jobs:
|
|
54
|
+
work-pr:
|
|
55
|
+
name: pr-check / Work PR
|
|
56
|
+
if: ${{ github.event.pull_request.head.ref != 'dev' && !github.event.pull_request.draft }}
|
|
57
|
+
runs-on: __RUNS_ON__
|
|
58
|
+
steps:
|
|
59
|
+
- uses: actions/checkout@v4
|
|
60
|
+
with:
|
|
61
|
+
ref: ${{ github.event.pull_request.head.sha }}
|
|
62
|
+
fetch-depth: 0
|
|
63
|
+
persist-credentials: false
|
|
64
|
+
|
|
65
|
+
- uses: actions/setup-node@v4
|
|
66
|
+
with:
|
|
67
|
+
node-version: 24
|
|
68
|
+
|
|
69
|
+
- uses: __CI_REPO__/actions/pr-checks@__CI_REF__
|
|
70
|
+
with:
|
|
71
|
+
kind: work
|
|
72
|
+
project-token: ${{ secrets.GH_PROJECT_TOKEN }}
|
|
73
|
+
|
|
74
|
+
release-pr:
|
|
75
|
+
name: pr-check / Release PR
|
|
76
|
+
if: ${{ github.event.pull_request.head.ref == 'dev' && !github.event.pull_request.draft }}
|
|
77
|
+
runs-on: __RUNS_ON__
|
|
78
|
+
steps:
|
|
79
|
+
# Full history with the tags: git-cliff computes the version from them.
|
|
80
|
+
- uses: actions/checkout@v4
|
|
81
|
+
with:
|
|
82
|
+
ref: ${{ github.event.pull_request.head.sha }}
|
|
83
|
+
fetch-depth: 0
|
|
84
|
+
persist-credentials: false
|
|
85
|
+
|
|
86
|
+
- uses: actions/setup-node@v4
|
|
87
|
+
with:
|
|
88
|
+
node-version: 24
|
|
89
|
+
|
|
90
|
+
- uses: __CI_REPO__/actions/pr-checks@__CI_REF__
|
|
91
|
+
with:
|
|
92
|
+
kind: release
|
|
93
|
+
project-token: ${{ secrets.GH_PROJECT_TOKEN }}
|
|
94
|
+
|
|
95
|
+
# A Node repo's own checks. Uncomment and adapt; other stacks replace the
|
|
96
|
+
# steps (e.g. `go test ./...`).
|
|
97
|
+
# validate:
|
|
98
|
+
# name: Validate
|
|
99
|
+
# runs-on: __RUNS_ON__
|
|
100
|
+
# steps:
|
|
101
|
+
# - uses: actions/checkout@v4
|
|
102
|
+
# - uses: actions/setup-node@v4
|
|
103
|
+
# with:
|
|
104
|
+
# node-version: 24
|
|
105
|
+
# cache: npm
|
|
106
|
+
# - run: npm ci
|
|
107
|
+
# # Prettier/ESLint/TypeScript extend @ebalzan/config instead of copying it.
|
|
108
|
+
# - run: npx --no-install ebalzan-config verify
|
|
109
|
+
# # The repo's own script: format:check, lint, typecheck, test, …
|
|
110
|
+
# - run: npm run validate
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# Release — runs __CI_REPO__'s release action.
|
|
3
|
+
#
|
|
4
|
+
# Runs when a PR into main is closed; the `release` job runs only when it is
|
|
5
|
+
# the dev → main release PR and it was merged (with a merge commit). Merging a
|
|
6
|
+
# work PR into dev never runs it. The release: the version from the
|
|
7
|
+
# Conventional Commits since the last tag, package.json bumped when there is
|
|
8
|
+
# one, the vX.Y.Z tag, the GitHub Release (the PR's description as notes), and
|
|
9
|
+
# dev brought up to main.
|
|
10
|
+
#
|
|
11
|
+
# Then `deploy` hands the new tag to deploy.yml — this repo's own file, where
|
|
12
|
+
# what ships the release lives. Generated by `ebalzan-ci onboard`; the release
|
|
13
|
+
# logic lives in the action (it follows __CI_REF__). Keep deploying out of this
|
|
14
|
+
# file.
|
|
15
|
+
# =============================================================================
|
|
16
|
+
name: Release
|
|
17
|
+
|
|
18
|
+
on:
|
|
19
|
+
pull_request:
|
|
20
|
+
types: [closed]
|
|
21
|
+
branches: ['main']
|
|
22
|
+
|
|
23
|
+
permissions:
|
|
24
|
+
contents: write
|
|
25
|
+
pull-requests: read
|
|
26
|
+
|
|
27
|
+
jobs:
|
|
28
|
+
release:
|
|
29
|
+
name: Version, tag and publish
|
|
30
|
+
if: >-
|
|
31
|
+
${{ github.event.pull_request.merged
|
|
32
|
+
&& github.event.pull_request.head.ref == 'dev'
|
|
33
|
+
&& github.event.pull_request.head.repo.full_name == github.repository }}
|
|
34
|
+
runs-on: __RUNS_ON__
|
|
35
|
+
# Queued, never cancelled: a run cut short could tag without a Release.
|
|
36
|
+
concurrency:
|
|
37
|
+
group: release-${{ github.repository }}
|
|
38
|
+
cancel-in-progress: false
|
|
39
|
+
env:
|
|
40
|
+
AUTO_BASE_BRANCH: dev
|
|
41
|
+
AUTO_RELEASE_BRANCH: main
|
|
42
|
+
outputs:
|
|
43
|
+
tag: ${{ steps.release.outputs.tag }}
|
|
44
|
+
sha: ${{ steps.release.outputs.sha }}
|
|
45
|
+
steps:
|
|
46
|
+
# The merge commit, with full history and the tags: git-cliff computes the
|
|
47
|
+
# version from them. Credentials stay: the job pushes main and dev.
|
|
48
|
+
- uses: actions/checkout@v4
|
|
49
|
+
with:
|
|
50
|
+
ref: ${{ github.event.pull_request.merge_commit_sha }}
|
|
51
|
+
fetch-depth: 0
|
|
52
|
+
|
|
53
|
+
- uses: actions/setup-node@v4
|
|
54
|
+
with:
|
|
55
|
+
node-version: 24
|
|
56
|
+
|
|
57
|
+
- id: release
|
|
58
|
+
uses: __CI_REPO__/actions/release@__CI_REF__
|
|
59
|
+
with:
|
|
60
|
+
dev-token: ${{ secrets.GH_PROJECT_TOKEN }}
|
|
61
|
+
|
|
62
|
+
deploy:
|
|
63
|
+
needs: release
|
|
64
|
+
if: ${{ needs.release.outputs.tag != '' }}
|
|
65
|
+
# What deploy.yml may use: a called workflow gets at most what this job
|
|
66
|
+
# grants. Keep it equal to deploy.yml's own `permissions` (e.g. add
|
|
67
|
+
# attestations: write to both).
|
|
68
|
+
permissions:
|
|
69
|
+
contents: read
|
|
70
|
+
id-token: write
|
|
71
|
+
packages: write
|
|
72
|
+
deployments: write
|
|
73
|
+
uses: ./.github/workflows/deploy.yml
|
|
74
|
+
with:
|
|
75
|
+
tag: ${{ needs.release.outputs.tag }}
|
|
76
|
+
secrets: inherit
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Conventional Commits check for every local commit, from __CI_PACKAGE__
|
|
2
|
+
# (generated by `ebalzan-ci onboard`). The same rule runs on every PR title in
|
|
3
|
+
# CI, so a missing package only loses the early local warning — never the check.
|
|
4
|
+
|
|
5
|
+
if [ -x node_modules/.bin/ebalzan-ci ]; then
|
|
6
|
+
exec node_modules/.bin/ebalzan-ci commit-msg "$1"
|
|
7
|
+
fi
|
|
8
|
+
|
|
9
|
+
echo "commit-msg: __CI_PACKAGE__ is not installed; commit message not checked locally."
|
|
10
|
+
echo "Install it with: npm install --save-dev __CI_PACKAGE__"
|
|
11
|
+
exit 0
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// ESLint: the shared rules from @ebalzan/config, then this repo's own blocks
|
|
2
|
+
// (generated by `ebalzan-ci onboard`). A later block wins for the files it
|
|
3
|
+
// matches, e.g. { ignores: ['generated/'] } or { files: [...], rules: {...} }.
|
|
4
|
+
import node from '@ebalzan/config/eslint/node'
|
|
5
|
+
|
|
6
|
+
export default [...node]
|
package/README.md
DELETED