@r5n/sisyphus 0.8.2 → 0.9.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.
@@ -6,25 +6,69 @@ on:
6
6
  types: [closed]
7
7
  branches: [main]
8
8
 
9
+ concurrency:
10
+ group: sisyphus-release
11
+ cancel-in-progress: false
12
+
9
13
  jobs:
10
14
  release:
11
15
  if: github.event_name == 'workflow_dispatch' || (github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'sisyphus-release'))
12
16
  runs-on: ubuntu-latest
13
17
  permissions:
14
18
  contents: write
15
- packages: write
19
+ id-token: write
16
20
  steps:
17
21
  - uses: actions/checkout@v7
18
22
  with:
19
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 }}
20
26
 
21
27
  - uses: oven-sh/setup-bun@v2
22
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.
34
+ - name: Restore release state
35
+ uses: actions/cache/restore@v5
36
+ with:
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 }}-
40
+
41
+ - name: Remove cached release lock
42
+ run: rm -f "$SIS_RELEASE_DIR/.write.lock" "$SIS_RELEASE_DIR"/.write.lock.*.owner "$SIS_RELEASE_DIR"/.write.lock.*.claim
43
+
44
+ - uses: actions/setup-node@v6
45
+ with:
46
+ node-version: 24
47
+ registry-url: https://registry.npmjs.org
48
+
49
+ - name: Install npm 11
50
+ run: npm install --global npm@11.5.1
51
+
23
52
  - name: Install dependencies
24
53
  run: bun install
25
54
 
55
+ - name: Install Sisyphus
56
+ run: bun add --global @r5n/sisyphus
57
+
26
58
  - name: Publish release
27
- run: bunx @r5n/sisyphus roll --publish-only --yes
59
+ run: |
60
+ if [ -f "$SIS_RELEASE_DIR/active.json" ]; then
61
+ sis roll --resume
62
+ else
63
+ sis roll --publish-only --yes
64
+ fi
28
65
  env:
29
66
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
67
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
68
+
69
+ - name: Save release state
70
+ if: always()
71
+ uses: actions/cache/save@v5
72
+ with:
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,8 +1,31 @@
1
1
  release:
2
2
  stage: sisyphus
3
3
  image: oven/bun:alpine
4
+ resource_group: sisyphus-release
5
+ cache:
6
+ key: "sisyphus-release-$CI_COMMIT_SHA"
7
+ policy: pull-push
8
+ when: always
9
+ paths:
10
+ - .git/sisyphus/release/
4
11
  before_script:
5
- - apk add --no-cache git
12
+ - apk add --no-cache git nodejs npm
13
+ - rm -f .git/sisyphus/release/.write.lock .git/sisyphus/release/.write.lock.*.owner .git/sisyphus/release/.write.lock.*.claim
14
+ - npm install --global npm@11.5.1
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
21
+ # release.tags / release.push need a push credential: CI_JOB_TOKEN cannot push, and Sisyphus
22
+ # rejects the token-embedded checkout URL. Set SIS_PUSH_TOKEN (project access token with
23
+ # write_repository scope) as a masked CI/CD variable to enable tag and branch pushes.
24
+ - |
25
+ if [ -n "$SIS_PUSH_TOKEN" ]; then
26
+ git remote set-url origin "${CI_SERVER_URL}/${CI_PROJECT_PATH}.git"
27
+ git config credential.helper '!f() { echo "username=oauth2"; echo "password=${SIS_PUSH_TOKEN}"; }; f'
28
+ fi
6
29
  rules:
7
30
  - if: $CI_PIPELINE_SOURCE == "web"
8
31
  when: manual
@@ -10,4 +33,5 @@ release:
10
33
  script:
11
34
  - git fetch --unshallow || true
12
35
  - bun install
13
- - bunx @r5n/sisyphus roll --publish-only --yes
36
+ - bun add --global @r5n/sisyphus
37
+ - if [ -f .git/sisyphus/release/active.json ]; then sis roll --resume; else sis roll --publish-only --yes; fi
package/package.json CHANGED
@@ -12,6 +12,10 @@
12
12
  "license": "Apache-2.0",
13
13
  "main": "dist/cli.js",
14
14
  "name": "@r5n/sisyphus",
15
+ "publishConfig": {
16
+ "access": "public",
17
+ "registry": "https://registry.npmjs.org/"
18
+ },
15
19
  "repository": {
16
20
  "type": "git",
17
21
  "url": "git+https://github.com/r5n-labs/clis.git"
@@ -27,5 +31,5 @@
27
31
  },
28
32
  "type": "module",
29
33
  "types": "src/cli.ts",
30
- "version": "0.8.2"
34
+ "version": "0.9.1"
31
35
  }
package/schema.json ADDED
@@ -0,0 +1,143 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://raw.githubusercontent.com/r5n-labs/clis/refs/heads/develop/packages/sisyphus/schema.json",
4
+ "title": "Sisyphus configuration",
5
+ "type": "object",
6
+ "properties": {
7
+ "$schema": { "type": "string" },
8
+ "single": { "type": "boolean" },
9
+ "tag": {
10
+ "type": "string",
11
+ "pattern": "^[A-Za-z][0-9A-Za-z._-]*$",
12
+ "not": { "pattern": "^(?:[vV]?\\d+(?:\\.(?:\\d+|[xX*])){0,2}(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?|[xX])$" }
13
+ },
14
+ "sisyphusDir": { "type": "string", "minLength": 1 },
15
+ "stonesPath": { "type": "string", "minLength": 1 },
16
+ "ignore": { "type": "array", "items": { "type": "string" }, "uniqueItems": true },
17
+ "plugins": { "type": "array", "items": { "type": "string" }, "uniqueItems": true },
18
+ "stones": {
19
+ "type": "array",
20
+ "items": { "type": "string", "pattern": "^[0-9A-Za-z][0-9A-Za-z_-]*$" },
21
+ "uniqueItems": true
22
+ },
23
+ "lastStone": {
24
+ "type": "object",
25
+ "additionalProperties": false,
26
+ "properties": { "commit": { "type": "string" }, "date": { "type": "string" } }
27
+ },
28
+ "commit": {
29
+ "type": "object",
30
+ "additionalProperties": false,
31
+ "properties": {
32
+ "author": { "type": "string" },
33
+ "email": { "type": "string", "pattern": "^[^\\s<>@]+@[^\\s<>@]+\\.[^\\s<>@]+$" },
34
+ "message": { "type": "string", "minLength": 1 }
35
+ }
36
+ },
37
+ "release": {
38
+ "type": "object",
39
+ "additionalProperties": false,
40
+ "properties": {
41
+ "createRelease": { "type": "boolean" },
42
+ "npm": { "type": "boolean" },
43
+ "push": { "type": "boolean" },
44
+ "tags": { "type": "boolean" }
45
+ }
46
+ },
47
+ "changelog": {
48
+ "type": "object",
49
+ "additionalProperties": false,
50
+ "properties": {
51
+ "append": { "type": "boolean" },
52
+ "filename": { "type": "string", "minLength": 1 },
53
+ "generate": { "type": "boolean" },
54
+ "packageHeader": { "type": "string" },
55
+ "root": { "type": "boolean" },
56
+ "rootHeader": { "type": "string" },
57
+ "template": { "type": "string" },
58
+ "sections": {
59
+ "type": "object",
60
+ "additionalProperties": false,
61
+ "properties": {
62
+ "breaking": { "type": "string" },
63
+ "build": { "type": "string" },
64
+ "chore": { "type": "string" },
65
+ "ci": { "type": "string" },
66
+ "dependencies": { "type": "string" },
67
+ "docs": { "type": "string" },
68
+ "feat": { "type": "string" },
69
+ "fix": { "type": "string" },
70
+ "other": { "type": "string" },
71
+ "perf": { "type": "string" },
72
+ "refactor": { "type": "string" },
73
+ "style": { "type": "string" },
74
+ "test": { "type": "string" }
75
+ }
76
+ }
77
+ }
78
+ },
79
+ "scripts": {
80
+ "type": "object",
81
+ "additionalProperties": false,
82
+ "properties": {
83
+ "pre": { "type": "object", "additionalProperties": { "type": "string" } },
84
+ "post": { "type": "object", "additionalProperties": { "type": "string" } }
85
+ }
86
+ },
87
+ "commits": {
88
+ "type": "object",
89
+ "additionalProperties": false,
90
+ "properties": {
91
+ "skip": {
92
+ "type": "object",
93
+ "additionalProperties": false,
94
+ "properties": {
95
+ "authors": { "type": "array", "items": { "type": "string" } },
96
+ "messagePatterns": { "type": "array", "items": { "type": "string" } }
97
+ }
98
+ }
99
+ }
100
+ },
101
+ "pr": {
102
+ "type": "object",
103
+ "additionalProperties": false,
104
+ "properties": {
105
+ "labelMapping": { "type": "object", "additionalProperties": { "enum": ["major", "minor", "patch"] } },
106
+ "skip": {
107
+ "type": "object",
108
+ "additionalProperties": false,
109
+ "properties": {
110
+ "authors": { "type": "array", "items": { "type": "string" } },
111
+ "labels": { "type": "array", "items": { "type": "string" } },
112
+ "titlePatterns": { "type": "array", "items": { "type": "string" } }
113
+ }
114
+ }
115
+ }
116
+ },
117
+ "currentRelease": {
118
+ "type": "object",
119
+ "additionalProperties": false,
120
+ "properties": {
121
+ "packages": {
122
+ "type": "object",
123
+ "additionalProperties": {
124
+ "type": "object",
125
+ "additionalProperties": false,
126
+ "properties": {
127
+ "oldVersion": { "type": "string", "minLength": 1 },
128
+ "newVersion": { "type": "string", "minLength": 1 }
129
+ }
130
+ }
131
+ },
132
+ "planHash": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
133
+ "sourceHash": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
134
+ "stoneIds": {
135
+ "type": "array",
136
+ "items": { "type": "string", "pattern": "^[0-9A-Za-z][0-9A-Za-z_-]*$" },
137
+ "uniqueItems": true
138
+ },
139
+ "timestamp": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}-\\d{2}-\\d{2}-\\d{3}Z$" }
140
+ }
141
+ }
142
+ }
143
+ }