@r5n/sisyphus 0.9.0 → 0.10.0
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/README.md +60 -2
- package/dist/cli.js +182 -183
- package/dist/templates/github/sis-create-stone.yml +14 -8
- package/dist/templates/github/sis-release.yml +14 -7
- package/dist/templates/gitlab/sis-create-stone.yml +25 -11
- package/dist/templates/gitlab/sis-release.yml +7 -2
- package/package.json +1 -1
- package/schema.json +47 -33
|
@@ -28,6 +28,9 @@ jobs:
|
|
|
28
28
|
- name: Install dependencies
|
|
29
29
|
run: bun install
|
|
30
30
|
|
|
31
|
+
- name: Install Sisyphus
|
|
32
|
+
run: bun add --global @r5n/sisyphus
|
|
33
|
+
|
|
31
34
|
- name: Configure git
|
|
32
35
|
run: |
|
|
33
36
|
git config user.name "r5n-bot[bot]"
|
|
@@ -36,14 +39,14 @@ jobs:
|
|
|
36
39
|
- name: Create stone from PR
|
|
37
40
|
id: stone
|
|
38
41
|
run: |
|
|
39
|
-
OUTPUT=$(
|
|
42
|
+
OUTPUT=$(sis pr --url "${{ github.event.pull_request.html_url }}" --yes 2>&1) && EXIT_CODE=0 || EXIT_CODE=$?
|
|
40
43
|
echo "$OUTPUT"
|
|
41
44
|
if echo "$OUTPUT" | grep -q "Skipping:"; then
|
|
42
|
-
echo "skipped=true" >> $GITHUB_OUTPUT
|
|
45
|
+
echo "skipped=true" >> "$GITHUB_OUTPUT"
|
|
43
46
|
else
|
|
44
|
-
echo "skipped=false" >> $GITHUB_OUTPUT
|
|
45
|
-
if [ $EXIT_CODE -ne 0 ]; then
|
|
46
|
-
exit $EXIT_CODE
|
|
47
|
+
echo "skipped=false" >> "$GITHUB_OUTPUT"
|
|
48
|
+
if [ "$EXIT_CODE" -ne 0 ]; then
|
|
49
|
+
exit "$EXIT_CODE"
|
|
47
50
|
fi
|
|
48
51
|
fi
|
|
49
52
|
env:
|
|
@@ -52,12 +55,12 @@ jobs:
|
|
|
52
55
|
- name: Commit and push stone
|
|
53
56
|
if: steps.stone.outputs.skipped == 'false'
|
|
54
57
|
run: |
|
|
55
|
-
git add .sisyphus/
|
|
58
|
+
git add .sisyphus/
|
|
56
59
|
git diff --cached --quiet || (git commit -m "chore: add stone from PR #${{ github.event.pull_request.number }}" && git push)
|
|
57
60
|
|
|
58
61
|
- name: Create or update release PR
|
|
59
62
|
if: steps.stone.outputs.skipped == 'false'
|
|
60
|
-
run:
|
|
63
|
+
run: sis actions release-pr
|
|
61
64
|
env:
|
|
62
65
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
63
66
|
|
|
@@ -77,12 +80,15 @@ jobs:
|
|
|
77
80
|
- name: Install dependencies
|
|
78
81
|
run: bun install
|
|
79
82
|
|
|
83
|
+
- name: Install Sisyphus
|
|
84
|
+
run: bun add --global @r5n/sisyphus
|
|
85
|
+
|
|
80
86
|
- name: Configure git
|
|
81
87
|
run: |
|
|
82
88
|
git config user.name "r5n-bot[bot]"
|
|
83
89
|
git config user.email "r5n-bot[bot]@users.noreply.github.com"
|
|
84
90
|
|
|
85
91
|
- name: Update release PR
|
|
86
|
-
run:
|
|
92
|
+
run: sis actions release-pr
|
|
87
93
|
env:
|
|
88
94
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -21,18 +21,25 @@ jobs:
|
|
|
21
21
|
- uses: actions/checkout@v7
|
|
22
22
|
with:
|
|
23
23
|
fetch-depth: 0
|
|
24
|
+
# pull_request:closed checks out an ephemeral merge ref; release tags must bind to the merged commit.
|
|
25
|
+
ref: ${{ github.event.pull_request.merge_commit_sha || github.sha }}
|
|
24
26
|
|
|
25
27
|
- uses: oven-sh/setup-bun@v2
|
|
26
28
|
|
|
29
|
+
- name: Resolve release state path
|
|
30
|
+
run: echo "SIS_RELEASE_DIR=$(git rev-parse --git-path sisyphus/release)" >> "$GITHUB_ENV"
|
|
31
|
+
|
|
32
|
+
# The cache key is sha-free and ref-stable so a workflow_dispatch recovery run
|
|
33
|
+
# restores the state saved by the failed merge-triggered run.
|
|
27
34
|
- name: Restore release state
|
|
28
35
|
uses: actions/cache/restore@v5
|
|
29
36
|
with:
|
|
30
|
-
path: .
|
|
31
|
-
key: sisyphus-release-${{ runner.os }}-${{ github.
|
|
32
|
-
restore-keys: sisyphus-release-${{ runner.os }}-${{ github.
|
|
37
|
+
path: ${{ env.SIS_RELEASE_DIR }}
|
|
38
|
+
key: sisyphus-release-${{ runner.os }}-${{ github.event.pull_request.base.ref || github.ref_name }}-${{ github.run_id }}-${{ github.run_attempt }}
|
|
39
|
+
restore-keys: sisyphus-release-${{ runner.os }}-${{ github.event.pull_request.base.ref || github.ref_name }}-
|
|
33
40
|
|
|
34
41
|
- name: Remove cached release lock
|
|
35
|
-
run: rm -f
|
|
42
|
+
run: rm -f "$SIS_RELEASE_DIR/.write.lock" "$SIS_RELEASE_DIR"/.write.lock.*.owner "$SIS_RELEASE_DIR"/.write.lock.*.claim
|
|
36
43
|
|
|
37
44
|
- uses: actions/setup-node@v6
|
|
38
45
|
with:
|
|
@@ -50,7 +57,7 @@ jobs:
|
|
|
50
57
|
|
|
51
58
|
- name: Publish release
|
|
52
59
|
run: |
|
|
53
|
-
if [ -f
|
|
60
|
+
if [ -f "$SIS_RELEASE_DIR/active.json" ]; then
|
|
54
61
|
sis roll --resume
|
|
55
62
|
else
|
|
56
63
|
sis roll --publish-only --yes
|
|
@@ -63,5 +70,5 @@ jobs:
|
|
|
63
70
|
if: always()
|
|
64
71
|
uses: actions/cache/save@v5
|
|
65
72
|
with:
|
|
66
|
-
path: .
|
|
67
|
-
key: sisyphus-release-${{ runner.os }}-${{ github.
|
|
73
|
+
path: ${{ env.SIS_RELEASE_DIR }}
|
|
74
|
+
key: sisyphus-release-${{ runner.os }}-${{ github.event.pull_request.base.ref || github.ref_name }}-${{ github.run_id }}-${{ github.run_attempt }}
|
|
@@ -1,13 +1,30 @@
|
|
|
1
1
|
handle-merge:
|
|
2
2
|
stage: sisyphus
|
|
3
3
|
image: oven/bun:alpine
|
|
4
|
-
before_script:
|
|
4
|
+
before_script: &sisyphus_before_script
|
|
5
5
|
- apk add --no-cache git
|
|
6
|
+
- |
|
|
7
|
+
if [ -z "${GITLAB_TOKEN:-}" ]; then
|
|
8
|
+
echo "Set GITLAB_TOKEN with api and write_repository access to create release merge requests" >&2
|
|
9
|
+
exit 1
|
|
10
|
+
fi
|
|
11
|
+
export SIS_PUSH_TOKEN="${SIS_PUSH_TOKEN:-$GITLAB_TOKEN}"
|
|
12
|
+
git remote set-url origin "${CI_SERVER_URL}/${CI_PROJECT_PATH}.git"
|
|
13
|
+
git config credential.helper ''
|
|
14
|
+
git config --add credential.helper '!f() { echo "username=oauth2"; echo "password=${SIS_PUSH_TOKEN}"; }; f'
|
|
15
|
+
- bun add --global @r5n/sisyphus
|
|
6
16
|
rules:
|
|
7
17
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_TITLE =~ /^Merge branch/ && $CI_COMMIT_TITLE !~ /sisyphus\/release/
|
|
8
18
|
script:
|
|
9
19
|
- |
|
|
10
|
-
MR_IID=$(
|
|
20
|
+
MR_IID=$(printf '%s\n' "$CI_COMMIT_DESCRIPTION" | awk -v prefix="See merge request ${CI_PROJECT_PATH}!" '
|
|
21
|
+
index($0, prefix) == 1 {
|
|
22
|
+
value = substr($0, length(prefix) + 1)
|
|
23
|
+
sub(/[[:space:]]+$/, "", value)
|
|
24
|
+
if (value ~ /^[0-9]+$/) iid = value
|
|
25
|
+
}
|
|
26
|
+
END { print iid }
|
|
27
|
+
')
|
|
11
28
|
if [ -z "$MR_IID" ]; then
|
|
12
29
|
echo "No MR IID found in commit description, skipping"
|
|
13
30
|
exit 0
|
|
@@ -18,9 +35,7 @@ handle-merge:
|
|
|
18
35
|
- git config user.email "r5n-bot[bot]@users.noreply.gitlab.com"
|
|
19
36
|
- bun install
|
|
20
37
|
- |
|
|
21
|
-
|
|
22
|
-
GIT_USER=$([ -n "$GITLAB_TOKEN" ] && echo "oauth2" || echo "gitlab-ci-token")
|
|
23
|
-
OUTPUT=$(bunx @r5n/sisyphus pr --url $CI_PROJECT_URL/-/merge_requests/$MR_IID --yes 2>&1) && EXIT_CODE=0 || EXIT_CODE=$?
|
|
38
|
+
OUTPUT=$(sis pr --url "$CI_PROJECT_URL/-/merge_requests/$MR_IID" --yes 2>&1) && EXIT_CODE=0 || EXIT_CODE=$?
|
|
24
39
|
echo "$OUTPUT"
|
|
25
40
|
if echo "$OUTPUT" | grep -q "Skipping:"; then
|
|
26
41
|
echo "Stone creation skipped"
|
|
@@ -29,16 +44,15 @@ handle-merge:
|
|
|
29
44
|
if [ $EXIT_CODE -ne 0 ]; then
|
|
30
45
|
exit $EXIT_CODE
|
|
31
46
|
fi
|
|
32
|
-
git add .sisyphus/
|
|
47
|
+
git add .sisyphus/
|
|
33
48
|
git diff --cached --quiet || git commit -m 'chore: add stone from MR !'"$MR_IID"
|
|
34
|
-
git push "
|
|
35
|
-
|
|
49
|
+
git push origin "HEAD:$CI_DEFAULT_BRANCH"
|
|
50
|
+
sis actions release-pr
|
|
36
51
|
|
|
37
52
|
handle-push:
|
|
38
53
|
stage: sisyphus
|
|
39
54
|
image: oven/bun:alpine
|
|
40
|
-
before_script:
|
|
41
|
-
- apk add --no-cache git
|
|
55
|
+
before_script: *sisyphus_before_script
|
|
42
56
|
rules:
|
|
43
57
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_TITLE !~ /^Merge branch/
|
|
44
58
|
script:
|
|
@@ -46,4 +60,4 @@ handle-push:
|
|
|
46
60
|
- git config user.name "r5n-bot[bot]"
|
|
47
61
|
- git config user.email "r5n-bot[bot]@users.noreply.gitlab.com"
|
|
48
62
|
- bun install
|
|
49
|
-
-
|
|
63
|
+
- sis actions release-pr
|
|
@@ -12,13 +12,18 @@ release:
|
|
|
12
12
|
- apk add --no-cache git nodejs npm
|
|
13
13
|
- rm -f .git/sisyphus/release/.write.lock .git/sisyphus/release/.write.lock.*.owner .git/sisyphus/release/.write.lock.*.claim
|
|
14
14
|
- npm install --global npm@11.5.1
|
|
15
|
-
-
|
|
15
|
+
- |
|
|
16
|
+
if [ -n "$NPM_TOKEN" ]; then
|
|
17
|
+
npm config set //registry.npmjs.org/:_authToken "$NPM_TOKEN"
|
|
18
|
+
else
|
|
19
|
+
echo "NPM_TOKEN is not set; npm publishing will fail without registry authentication" >&2
|
|
20
|
+
fi
|
|
16
21
|
# release.tags / release.push need a push credential: CI_JOB_TOKEN cannot push, and Sisyphus
|
|
17
22
|
# rejects the token-embedded checkout URL. Set SIS_PUSH_TOKEN (project access token with
|
|
18
23
|
# write_repository scope) as a masked CI/CD variable to enable tag and branch pushes.
|
|
19
24
|
- |
|
|
20
25
|
if [ -n "$SIS_PUSH_TOKEN" ]; then
|
|
21
|
-
git remote set-url origin "
|
|
26
|
+
git remote set-url origin "${CI_SERVER_URL}/${CI_PROJECT_PATH}.git"
|
|
22
27
|
git config credential.helper '!f() { echo "username=oauth2"; echo "password=${SIS_PUSH_TOKEN}"; }; f'
|
|
23
28
|
fi
|
|
24
29
|
rules:
|
package/package.json
CHANGED
package/schema.json
CHANGED
|
@@ -13,7 +13,29 @@
|
|
|
13
13
|
},
|
|
14
14
|
"sisyphusDir": { "type": "string", "minLength": 1 },
|
|
15
15
|
"stonesPath": { "type": "string", "minLength": 1 },
|
|
16
|
-
"ignore": {
|
|
16
|
+
"ignore": {
|
|
17
|
+
"type": "array",
|
|
18
|
+
"description": "Package names or globs that are never released. Globs use path semantics, so scoped names need '@scope/*' rather than '*'.",
|
|
19
|
+
"items": { "type": "string", "minLength": 1 },
|
|
20
|
+
"uniqueItems": true
|
|
21
|
+
},
|
|
22
|
+
"dependents": {
|
|
23
|
+
"type": "object",
|
|
24
|
+
"additionalProperties": false,
|
|
25
|
+
"description": "How dependent packages are pulled into a release.",
|
|
26
|
+
"properties": {
|
|
27
|
+
"kinds": {
|
|
28
|
+
"type": "array",
|
|
29
|
+
"description": "Manifest sections whose workspace dependencies make a dependent releasable. Keep 'devDependencies' when packages are bundled at build time; drop it when only the published manifest matters.",
|
|
30
|
+
"items": { "enum": ["dependencies", "devDependencies", "optionalDependencies", "peerDependencies"] },
|
|
31
|
+
"uniqueItems": true
|
|
32
|
+
},
|
|
33
|
+
"updateInternal": {
|
|
34
|
+
"enum": ["always", "outOfRange"],
|
|
35
|
+
"description": "'always' releases every dependent; 'outOfRange' releases a dependent only when its published range no longer admits the new version. A literal 'workspace:<range>' is never rewritten by a release, so it never triggers one."
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
17
39
|
"plugins": { "type": "array", "items": { "type": "string" }, "uniqueItems": true },
|
|
18
40
|
"stones": {
|
|
19
41
|
"type": "array",
|
|
@@ -23,29 +45,44 @@
|
|
|
23
45
|
"lastStone": {
|
|
24
46
|
"type": "object",
|
|
25
47
|
"additionalProperties": false,
|
|
26
|
-
"required": ["commit", "date"],
|
|
27
48
|
"properties": { "commit": { "type": "string" }, "date": { "type": "string" } }
|
|
28
49
|
},
|
|
29
50
|
"commit": {
|
|
30
51
|
"type": "object",
|
|
31
52
|
"additionalProperties": false,
|
|
32
|
-
"required": ["author", "message"],
|
|
33
53
|
"properties": {
|
|
34
54
|
"author": { "type": "string" },
|
|
35
|
-
"email": { "type": "string" },
|
|
55
|
+
"email": { "type": "string", "pattern": "^[^\\s<>@]+@[^\\s<>@]+\\.[^\\s<>@]+$" },
|
|
36
56
|
"message": { "type": "string", "minLength": 1 }
|
|
37
|
-
},
|
|
38
|
-
"if": { "properties": { "author": { "pattern": "\\S" } } },
|
|
39
|
-
"then": {
|
|
40
|
-
"required": ["email"],
|
|
41
|
-
"properties": { "email": { "pattern": "^[^\\s<>@]+@[^\\s<>@]+\\.[^\\s<>@]+$" } }
|
|
42
57
|
}
|
|
43
58
|
},
|
|
44
59
|
"release": {
|
|
45
60
|
"type": "object",
|
|
46
61
|
"additionalProperties": false,
|
|
47
|
-
"required": ["createRelease", "npm", "push", "tags"],
|
|
48
62
|
"properties": {
|
|
63
|
+
"build": {
|
|
64
|
+
"type": "object",
|
|
65
|
+
"additionalProperties": false,
|
|
66
|
+
"description": "How package artifacts are built before packing.",
|
|
67
|
+
"properties": {
|
|
68
|
+
"command": {
|
|
69
|
+
"type": "array",
|
|
70
|
+
"description": "Argv for the per-package build, run in the package directory. An empty array disables it.",
|
|
71
|
+
"items": { "type": "string", "minLength": 1 }
|
|
72
|
+
},
|
|
73
|
+
"outputs": {
|
|
74
|
+
"type": "array",
|
|
75
|
+
"description": "Repository-root-relative globs written by the release build. They are cleaned before the build and exempted from the ignored-input and pack-input guards.",
|
|
76
|
+
"items": { "type": "string", "minLength": 1, "not": { "pattern": "^(\\.\\.?/|/)" } },
|
|
77
|
+
"uniqueItems": true
|
|
78
|
+
},
|
|
79
|
+
"root": {
|
|
80
|
+
"type": "array",
|
|
81
|
+
"description": "Argv arrays run once at the repository root before the first package is packed.",
|
|
82
|
+
"items": { "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 1 } }
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
49
86
|
"createRelease": { "type": "boolean" },
|
|
50
87
|
"npm": { "type": "boolean" },
|
|
51
88
|
"push": { "type": "boolean" },
|
|
@@ -55,7 +92,6 @@
|
|
|
55
92
|
"changelog": {
|
|
56
93
|
"type": "object",
|
|
57
94
|
"additionalProperties": false,
|
|
58
|
-
"required": ["append", "filename", "generate", "packageHeader", "root", "rootHeader", "sections"],
|
|
59
95
|
"properties": {
|
|
60
96
|
"append": { "type": "boolean" },
|
|
61
97
|
"filename": { "type": "string", "minLength": 1 },
|
|
@@ -67,21 +103,6 @@
|
|
|
67
103
|
"sections": {
|
|
68
104
|
"type": "object",
|
|
69
105
|
"additionalProperties": false,
|
|
70
|
-
"required": [
|
|
71
|
-
"breaking",
|
|
72
|
-
"build",
|
|
73
|
-
"chore",
|
|
74
|
-
"ci",
|
|
75
|
-
"dependencies",
|
|
76
|
-
"docs",
|
|
77
|
-
"feat",
|
|
78
|
-
"fix",
|
|
79
|
-
"other",
|
|
80
|
-
"perf",
|
|
81
|
-
"refactor",
|
|
82
|
-
"style",
|
|
83
|
-
"test"
|
|
84
|
-
],
|
|
85
106
|
"properties": {
|
|
86
107
|
"breaking": { "type": "string" },
|
|
87
108
|
"build": { "type": "string" },
|
|
@@ -103,7 +124,6 @@
|
|
|
103
124
|
"scripts": {
|
|
104
125
|
"type": "object",
|
|
105
126
|
"additionalProperties": false,
|
|
106
|
-
"required": ["pre", "post"],
|
|
107
127
|
"properties": {
|
|
108
128
|
"pre": { "type": "object", "additionalProperties": { "type": "string" } },
|
|
109
129
|
"post": { "type": "object", "additionalProperties": { "type": "string" } }
|
|
@@ -112,12 +132,10 @@
|
|
|
112
132
|
"commits": {
|
|
113
133
|
"type": "object",
|
|
114
134
|
"additionalProperties": false,
|
|
115
|
-
"required": ["skip"],
|
|
116
135
|
"properties": {
|
|
117
136
|
"skip": {
|
|
118
137
|
"type": "object",
|
|
119
138
|
"additionalProperties": false,
|
|
120
|
-
"required": ["authors", "messagePatterns"],
|
|
121
139
|
"properties": {
|
|
122
140
|
"authors": { "type": "array", "items": { "type": "string" } },
|
|
123
141
|
"messagePatterns": { "type": "array", "items": { "type": "string" } }
|
|
@@ -128,13 +146,11 @@
|
|
|
128
146
|
"pr": {
|
|
129
147
|
"type": "object",
|
|
130
148
|
"additionalProperties": false,
|
|
131
|
-
"required": ["labelMapping", "skip"],
|
|
132
149
|
"properties": {
|
|
133
150
|
"labelMapping": { "type": "object", "additionalProperties": { "enum": ["major", "minor", "patch"] } },
|
|
134
151
|
"skip": {
|
|
135
152
|
"type": "object",
|
|
136
153
|
"additionalProperties": false,
|
|
137
|
-
"required": ["authors", "labels", "titlePatterns"],
|
|
138
154
|
"properties": {
|
|
139
155
|
"authors": { "type": "array", "items": { "type": "string" } },
|
|
140
156
|
"labels": { "type": "array", "items": { "type": "string" } },
|
|
@@ -146,14 +162,12 @@
|
|
|
146
162
|
"currentRelease": {
|
|
147
163
|
"type": "object",
|
|
148
164
|
"additionalProperties": false,
|
|
149
|
-
"required": ["packages", "planHash", "sourceHash", "stoneIds", "timestamp"],
|
|
150
165
|
"properties": {
|
|
151
166
|
"packages": {
|
|
152
167
|
"type": "object",
|
|
153
168
|
"additionalProperties": {
|
|
154
169
|
"type": "object",
|
|
155
170
|
"additionalProperties": false,
|
|
156
|
-
"required": ["oldVersion", "newVersion"],
|
|
157
171
|
"properties": {
|
|
158
172
|
"oldVersion": { "type": "string", "minLength": 1 },
|
|
159
173
|
"newVersion": { "type": "string", "minLength": 1 }
|