@r5n/sisyphus 0.13.3 → 0.14.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.
@@ -7,29 +7,25 @@ on:
7
7
  types: [closed]
8
8
  branches: [main]
9
9
 
10
- concurrency:
11
- group: sisyphus-${{ github.ref }}
12
- cancel-in-progress: false
13
-
14
10
  jobs:
15
11
  handle-merge:
16
12
  if: github.event_name == 'pull_request' && github.event.pull_request.merged == true && !contains(github.event.pull_request.labels.*.name, 'sisyphus-release')
17
13
  runs-on: ubuntu-latest
18
14
  permissions:
19
15
  contents: write
20
- pull-requests: write
16
+ pull-requests: read
17
+ outputs:
18
+ status: ${{ steps.stone.outputs.status }}
21
19
  steps:
22
20
  - uses: actions/checkout@v7
23
21
  with:
24
22
  fetch-depth: 0
23
+ ref: ${{ github.event.pull_request.base.ref }}
25
24
 
26
25
  - uses: oven-sh/setup-bun@v2
27
26
 
28
- - name: Install dependencies
29
- run: bun install
30
-
31
27
  - name: Install Sisyphus
32
- run: bun add --global @r5n/sisyphus
28
+ run: bun add --global @r5n/sisyphus@__SISYPHUS_VERSION__
33
29
 
34
30
  - name: Configure git
35
31
  run: |
@@ -39,34 +35,72 @@ jobs:
39
35
  - name: Create stone from PR
40
36
  id: stone
41
37
  run: |
42
- OUTPUT=$(sis pr --url "${{ github.event.pull_request.html_url }}" --yes 2>&1) && EXIT_CODE=0 || EXIT_CODE=$?
43
- echo "$OUTPUT"
44
- if echo "$OUTPUT" | grep -q "Skipping:"; then
45
- echo "skipped=true" >> "$GITHUB_OUTPUT"
46
- else
47
- echo "skipped=false" >> "$GITHUB_OUTPUT"
48
- if [ "$EXIT_CODE" -ne 0 ]; then
49
- exit "$EXIT_CODE"
50
- fi
51
- fi
38
+ RESULT=$(sis pr --url "$PR_URL" --yes --json) || exit $?
39
+ STATUS=$(printf '%s' "$RESULT" | bun -e 'console.log(JSON.parse(await Bun.stdin.text()).status)')
40
+ echo "Stone status: $STATUS"
41
+ echo "status=$STATUS" >> "$GITHUB_OUTPUT"
52
42
  env:
43
+ GH_ENTERPRISE_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53
44
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45
+ PR_URL: ${{ github.event.pull_request.html_url }}
54
46
 
55
47
  - name: Commit and push stone
56
- if: steps.stone.outputs.skipped == 'false'
48
+ if: steps.stone.outputs.status == 'created'
57
49
  run: |
58
50
  git add .sisyphus/
59
- git diff --cached --quiet || (git commit -m "chore: add stone from PR #${{ github.event.pull_request.number }}" && git push)
51
+ git diff --cached --quiet || git commit -m "chore: add stone from PR #$PR_NUMBER"
52
+ for attempt in 1 2 3 4 5; do
53
+ if git push origin "HEAD:$BASE_REF"; then
54
+ exit 0
55
+ fi
56
+ echo "Stone push to $BASE_REF was rejected (attempt $attempt); rebasing onto the latest $BASE_REF" >&2
57
+ git fetch origin "$BASE_REF"
58
+ git rebase FETCH_HEAD
59
+ done
60
+ echo "Could not push the stone to $BASE_REF after 5 attempts" >&2
61
+ exit 1
62
+ env:
63
+ BASE_REF: ${{ github.event.pull_request.base.ref }}
64
+ PR_NUMBER: ${{ github.event.pull_request.number }}
65
+
66
+ release-pr:
67
+ needs: handle-merge
68
+ if: needs.handle-merge.outputs.status == 'created'
69
+ runs-on: ubuntu-latest
70
+ concurrency:
71
+ group: sisyphus-release-pr-${{ github.event.pull_request.base.ref }}
72
+ cancel-in-progress: false
73
+ permissions:
74
+ contents: write
75
+ pull-requests: write
76
+ steps:
77
+ - uses: actions/checkout@v7
78
+ with:
79
+ fetch-depth: 0
80
+ ref: ${{ github.event.pull_request.base.ref }}
81
+
82
+ - uses: oven-sh/setup-bun@v2
83
+
84
+ - name: Install Sisyphus
85
+ run: bun add --global @r5n/sisyphus@__SISYPHUS_VERSION__
86
+
87
+ - name: Configure git
88
+ run: |
89
+ git config user.name "r5n-bot[bot]"
90
+ git config user.email "r5n-bot[bot]@users.noreply.github.com"
60
91
 
61
92
  - name: Create or update release PR
62
- if: steps.stone.outputs.skipped == 'false'
63
93
  run: sis actions release-pr
64
94
  env:
95
+ GH_ENTERPRISE_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65
96
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66
97
 
67
98
  handle-push:
68
99
  if: github.event_name == 'push' && github.event.head_commit.committer.username != 'web-flow'
69
100
  runs-on: ubuntu-latest
101
+ concurrency:
102
+ group: sisyphus-release-pr-${{ github.ref_name }}
103
+ cancel-in-progress: false
70
104
  permissions:
71
105
  contents: write
72
106
  pull-requests: write
@@ -77,11 +111,8 @@ jobs:
77
111
 
78
112
  - uses: oven-sh/setup-bun@v2
79
113
 
80
- - name: Install dependencies
81
- run: bun install
82
-
83
114
  - name: Install Sisyphus
84
- run: bun add --global @r5n/sisyphus
115
+ run: bun add --global @r5n/sisyphus@__SISYPHUS_VERSION__
85
116
 
86
117
  - name: Configure git
87
118
  run: |
@@ -91,4 +122,5 @@ jobs:
91
122
  - name: Update release PR
92
123
  run: sis actions release-pr
93
124
  env:
125
+ GH_ENTERPRISE_TOKEN: ${{ secrets.GITHUB_TOKEN }}
94
126
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -42,19 +42,19 @@ jobs:
42
42
  - name: Remove cached release lock
43
43
  run: rm -f "$SIS_RELEASE_DIR/.write.lock" "$SIS_RELEASE_DIR"/.write.lock.*.owner "$SIS_RELEASE_DIR"/.write.lock.*.claim
44
44
 
45
- - uses: actions/setup-node@v6
45
+ - uses: actions/setup-node@v7
46
46
  with:
47
47
  node-version: 24
48
48
  registry-url: https://registry.npmjs.org
49
49
 
50
50
  - name: Install npm 11
51
- run: npm install --global npm@11.5.1
51
+ run: npm install --global npm@11.21.3
52
52
 
53
53
  - name: Install dependencies
54
54
  run: bun install
55
55
 
56
56
  - name: Install Sisyphus
57
- run: bun add --global @r5n/sisyphus
57
+ run: bun add --global @r5n/sisyphus@__SISYPHUS_VERSION__
58
58
 
59
59
  - name: Publish release
60
60
  run: |
@@ -64,6 +64,7 @@ jobs:
64
64
  sis roll --publish-only --yes
65
65
  fi
66
66
  env:
67
+ GH_ENTERPRISE_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67
68
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68
69
  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
69
70
 
@@ -1,6 +1,7 @@
1
1
  handle-merge:
2
2
  stage: sisyphus
3
3
  image: oven/bun:alpine
4
+ resource_group: sisyphus-release-mr
4
5
  before_script: &sisyphus_before_script
5
6
  - apk add --no-cache git
6
7
  - |
@@ -12,7 +13,7 @@ handle-merge:
12
13
  git remote set-url origin "${CI_SERVER_URL}/${CI_PROJECT_PATH}.git"
13
14
  git config credential.helper ''
14
15
  git config --add credential.helper '!f() { echo "username=oauth2"; echo "password=${SIS_PUSH_TOKEN}"; }; f'
15
- - bun add --global @r5n/sisyphus
16
+ - bun add --global @r5n/sisyphus@__SISYPHUS_VERSION__
16
17
  rules:
17
18
  - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_TITLE =~ /^Merge branch/ && $CI_COMMIT_TITLE !~ /sisyphus\/release/
18
19
  script:
@@ -33,25 +34,33 @@ handle-merge:
33
34
  - git fetch --unshallow || true
34
35
  - git config user.name "r5n-bot[bot]"
35
36
  - git config user.email "r5n-bot[bot]@users.noreply.gitlab.com"
36
- - bun install
37
37
  - |
38
- OUTPUT=$(sis pr --url "$CI_PROJECT_URL/-/merge_requests/$MR_IID" --yes 2>&1) && EXIT_CODE=0 || EXIT_CODE=$?
39
- echo "$OUTPUT"
40
- if echo "$OUTPUT" | grep -q "Skipping:"; then
38
+ RESULT=$(sis pr --url "$CI_PROJECT_URL/-/merge_requests/$MR_IID" --yes --json) || exit $?
39
+ STATUS=$(printf '%s' "$RESULT" | bun -e 'console.log(JSON.parse(await Bun.stdin.text()).status)')
40
+ echo "Stone status: $STATUS"
41
+ if [ "$STATUS" != "created" ]; then
41
42
  echo "Stone creation skipped"
42
43
  exit 0
43
44
  fi
44
- if [ $EXIT_CODE -ne 0 ]; then
45
- exit $EXIT_CODE
46
- fi
47
45
  git add .sisyphus/
48
46
  git diff --cached --quiet || git commit -m 'chore: add stone from MR !'"$MR_IID"
49
- git push origin "HEAD:$CI_DEFAULT_BRANCH"
47
+ attempt=1
48
+ until git push origin "HEAD:$CI_DEFAULT_BRANCH"; do
49
+ if [ "$attempt" -ge 5 ]; then
50
+ echo "Could not push the stone to $CI_DEFAULT_BRANCH after $attempt attempts" >&2
51
+ exit 1
52
+ fi
53
+ echo "Stone push to $CI_DEFAULT_BRANCH was rejected (attempt $attempt); rebasing onto the latest $CI_DEFAULT_BRANCH" >&2
54
+ git fetch origin "$CI_DEFAULT_BRANCH"
55
+ git rebase FETCH_HEAD
56
+ attempt=$((attempt + 1))
57
+ done
50
58
  sis actions release-pr
51
59
 
52
60
  handle-push:
53
61
  stage: sisyphus
54
62
  image: oven/bun:alpine
63
+ resource_group: sisyphus-release-mr
55
64
  before_script: *sisyphus_before_script
56
65
  rules:
57
66
  - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_TITLE !~ /^Merge branch/
@@ -59,5 +68,4 @@ handle-push:
59
68
  - git fetch --unshallow || true
60
69
  - git config user.name "r5n-bot[bot]"
61
70
  - git config user.email "r5n-bot[bot]@users.noreply.gitlab.com"
62
- - bun install
63
71
  - sis actions release-pr
@@ -13,7 +13,7 @@ release:
13
13
  before_script:
14
14
  - apk add --no-cache git nodejs npm
15
15
  - rm -f .git/sisyphus/release/.write.lock .git/sisyphus/release/.write.lock.*.owner .git/sisyphus/release/.write.lock.*.claim
16
- - npm install --global npm@11.5.1
16
+ - npm install --global npm@11.21.3
17
17
  - |
18
18
  if [ -n "$NPM_TOKEN" ]; then
19
19
  npm config set //registry.npmjs.org/:_authToken "$NPM_TOKEN"
@@ -35,7 +35,7 @@ release:
35
35
  script:
36
36
  - git fetch --unshallow || true
37
37
  - bun install
38
- - bun add --global @r5n/sisyphus
38
+ - bun add --global @r5n/sisyphus@__SISYPHUS_VERSION__
39
39
  - if [ -f .git/sisyphus/release/active.json ]; then sis roll --resume; else sis roll --publish-only --yes; fi
40
40
  after_script:
41
41
  - if [ ! -f .git/sisyphus/release/active.json ] && ! ls .git/sisyphus/release/history/*.json >/dev/null 2>&1; then rm -rf .git/sisyphus/release; fi
package/package.json CHANGED
@@ -29,6 +29,5 @@
29
29
  "package:publish": "bun ../../tools/scripts/publish-package.ts ."
30
30
  },
31
31
  "type": "module",
32
- "types": "src/cli.ts",
33
- "version": "0.13.3"
32
+ "version": "0.14.0"
34
33
  }
package/schema.json CHANGED
@@ -98,7 +98,11 @@
98
98
  "type": "object",
99
99
  "additionalProperties": false,
100
100
  "properties": {
101
- "append": { "type": "boolean" },
101
+ "append": {
102
+ "type": "boolean",
103
+ "default": false,
104
+ "description": "false writes each release entry above the previous ones (newest first); true writes it after them (oldest first). The title line stays at the top either way."
105
+ },
102
106
  "filename": { "type": "string", "minLength": 1 },
103
107
  "generate": { "type": "boolean" },
104
108
  "packageHeader": { "type": "string" },
@@ -164,6 +168,27 @@
164
168
  }
165
169
  }
166
170
  },
171
+ "provider": {
172
+ "type": "object",
173
+ "additionalProperties": false,
174
+ "required": ["type"],
175
+ "description": "The git hosting provider of the origin remote. Only needed when origin is not on github.com, gitlab.com or bitbucket.org, or uses an SSH host alias; GitLab CI and GitHub Actions also recognise their own server host without it.",
176
+ "properties": {
177
+ "type": { "enum": ["github", "gitlab"] },
178
+ "host": {
179
+ "type": "string",
180
+ "pattern": "^[A-Za-z0-9](?:[A-Za-z0-9.-]*[A-Za-z0-9])?(?::[0-9]{1,5})?$",
181
+ "description": "Web host of the provider, with an optional port, such as github.example.com. Defaults to the host of the origin remote, so set it for an SSH host alias."
182
+ },
183
+ "apiUrl": {
184
+ "type": "string",
185
+ "pattern": "^https?://",
186
+ "description": "GitLab only: REST API base URL. Defaults to CI_API_V4_URL, then https://<host>/api/v4. GitHub uses gh, which derives the API from host."
187
+ }
188
+ },
189
+ "if": { "properties": { "type": { "const": "github" } } },
190
+ "then": { "not": { "required": ["apiUrl"] } }
191
+ },
167
192
  "currentRelease": {
168
193
  "type": "object",
169
194
  "additionalProperties": false,