@r5n/sisyphus 0.4.8 → 0.5.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.
@@ -0,0 +1,88 @@
1
+ name: Sisyphus - Handle PR Merge
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ types: [closed]
8
+ branches: [main]
9
+
10
+ concurrency:
11
+ group: sisyphus-${{ github.ref }}
12
+ cancel-in-progress: false
13
+
14
+ jobs:
15
+ handle-merge:
16
+ if: github.event_name == 'pull_request' && github.event.pull_request.merged == true && !contains(github.event.pull_request.labels.*.name, 'sisyphus-release')
17
+ runs-on: ubuntu-latest
18
+ permissions:
19
+ contents: write
20
+ pull-requests: write
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+ with:
24
+ fetch-depth: 0
25
+
26
+ - uses: oven-sh/setup-bun@v2
27
+
28
+ - name: Install dependencies
29
+ run: bun install
30
+
31
+ - name: Configure git
32
+ run: |
33
+ git config user.name "r5n-bot[bot]"
34
+ git config user.email "r5n-bot[bot]@users.noreply.github.com"
35
+
36
+ - name: Create stone from PR
37
+ id: stone
38
+ run: |
39
+ OUTPUT=$(bunx @r5n/sisyphus pr --url ${{ github.event.pull_request.html_url }} --yes 2>&1) && EXIT_CODE=0 || EXIT_CODE=$?
40
+ echo "$OUTPUT"
41
+ if echo "$OUTPUT" | grep -q "Skipping:"; then
42
+ echo "skipped=true" >> $GITHUB_OUTPUT
43
+ else
44
+ echo "skipped=false" >> $GITHUB_OUTPUT
45
+ if [ $EXIT_CODE -ne 0 ]; then
46
+ exit $EXIT_CODE
47
+ fi
48
+ fi
49
+ env:
50
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51
+
52
+ - name: Commit and push stone
53
+ if: steps.stone.outputs.skipped == 'false'
54
+ run: |
55
+ git add .sisyphus/stones/
56
+ git diff --cached --quiet || (git commit -m "chore: add stone from PR #${{ github.event.pull_request.number }}" && git push)
57
+
58
+ - name: Create or update release PR
59
+ if: steps.stone.outputs.skipped == 'false'
60
+ run: bunx @r5n/sisyphus actions release-pr
61
+ env:
62
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63
+
64
+ handle-push:
65
+ if: github.event_name == 'push' && github.event.head_commit.committer.username != 'web-flow'
66
+ runs-on: ubuntu-latest
67
+ permissions:
68
+ contents: write
69
+ pull-requests: write
70
+ steps:
71
+ - uses: actions/checkout@v4
72
+ with:
73
+ fetch-depth: 0
74
+
75
+ - uses: oven-sh/setup-bun@v2
76
+
77
+ - name: Install dependencies
78
+ run: bun install
79
+
80
+ - name: Configure git
81
+ run: |
82
+ git config user.name "r5n-bot[bot]"
83
+ git config user.email "r5n-bot[bot]@users.noreply.github.com"
84
+
85
+ - name: Update release PR
86
+ run: bunx @r5n/sisyphus actions release-pr
87
+ env:
88
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,30 @@
1
+ name: Release
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ pull_request:
6
+ types: [closed]
7
+ branches: [main]
8
+
9
+ jobs:
10
+ release:
11
+ if: github.event_name == 'workflow_dispatch' || (github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'sisyphus-release'))
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ contents: write
15
+ packages: write
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ with:
19
+ fetch-depth: 0
20
+
21
+ - uses: oven-sh/setup-bun@v2
22
+
23
+ - name: Install dependencies
24
+ run: bun install
25
+
26
+ - name: Publish release
27
+ run: bunx @r5n/sisyphus roll --publish-only --yes
28
+ env:
29
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -0,0 +1,49 @@
1
+ handle-merge:
2
+ stage: sisyphus
3
+ image: oven/bun:alpine
4
+ before_script:
5
+ - apk add --no-cache git
6
+ rules:
7
+ - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_TITLE =~ /^Merge branch/ && $CI_COMMIT_TITLE !~ /sisyphus\/release/
8
+ script:
9
+ - |
10
+ MR_IID=$(echo "$CI_COMMIT_DESCRIPTION" | grep -o '![0-9]*' | grep -o '[0-9]*' | head -1)
11
+ if [ -z "$MR_IID" ]; then
12
+ echo "No MR IID found in commit description, skipping"
13
+ exit 0
14
+ fi
15
+ echo "Detected MR !$MR_IID"
16
+ - git fetch --unshallow || true
17
+ - git config user.name "r5n-bot[bot]"
18
+ - git config user.email "r5n-bot[bot]@users.noreply.gitlab.com"
19
+ - bun install
20
+ - |
21
+ GIT_TOKEN="${GITLAB_TOKEN:-$CI_JOB_TOKEN}"
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=$?
24
+ echo "$OUTPUT"
25
+ if echo "$OUTPUT" | grep -q "Skipping:"; then
26
+ echo "Stone creation skipped"
27
+ exit 0
28
+ fi
29
+ if [ $EXIT_CODE -ne 0 ]; then
30
+ exit $EXIT_CODE
31
+ fi
32
+ git add .sisyphus/stones/
33
+ git diff --cached --quiet || git commit -m 'chore: add stone from MR !'"$MR_IID"
34
+ git push "https://${GIT_USER}:${GIT_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git" HEAD:$CI_DEFAULT_BRANCH
35
+ bunx @r5n/sisyphus actions release-pr
36
+
37
+ handle-push:
38
+ stage: sisyphus
39
+ image: oven/bun:alpine
40
+ before_script:
41
+ - apk add --no-cache git
42
+ rules:
43
+ - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_TITLE !~ /^Merge branch/
44
+ script:
45
+ - git fetch --unshallow || true
46
+ - git config user.name "r5n-bot[bot]"
47
+ - git config user.email "r5n-bot[bot]@users.noreply.gitlab.com"
48
+ - bun install
49
+ - bunx @r5n/sisyphus actions release-pr
@@ -0,0 +1,13 @@
1
+ release:
2
+ stage: sisyphus
3
+ image: oven/bun:alpine
4
+ before_script:
5
+ - apk add --no-cache git
6
+ rules:
7
+ - if: $CI_PIPELINE_SOURCE == "web"
8
+ when: manual
9
+ - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_TITLE =~ /^Merge branch.*sisyphus\/release/
10
+ script:
11
+ - git fetch --unshallow || true
12
+ - bun install
13
+ - bunx @r5n/sisyphus roll --publish-only --yes
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
- "author": "@ice-chillios",
3
2
  "bin": {
4
- "sisyphus": "./dist/cli.js"
3
+ "sisyphus": "dist/cli.js"
5
4
  },
6
5
  "description": "Sisyphus CLI - A tool for versioning and publishing packages",
7
6
  "devDependencies": {
8
- "@clack/prompts": "1.0.0-alpha.6",
7
+ "@clack/prompts": "1.7.0",
9
8
  "@r5n/cli-core": "workspace:*",
10
9
  "@r5n/tools": "workspace:*"
11
10
  },
@@ -17,10 +16,6 @@
17
16
  "license": "Apache-2.0",
18
17
  "main": "dist/cli.js",
19
18
  "name": "@r5n/sisyphus",
20
- "publishConfig": {
21
- "access": "public",
22
- "registry": "https://registry.npmjs.org/"
23
- },
24
19
  "repository": {
25
20
  "type": "git",
26
21
  "url": "git+https://github.com/r5n-labs/clis.git"
@@ -29,13 +24,12 @@
29
24
  "build": "rm -rf dist && bun build.ts",
30
25
  "clean": "rm -rf dist node_modules",
31
26
  "dev": "bun --bun src/cli.ts",
32
- "package:dryRun": "bun run package:prepare && bun publish --dry-run --no-git-checks --access public --force && bun install",
27
+ "package:dryRun": "bun ../../tools/scripts/publish-package.ts . --dry-run",
33
28
  "package:prepare": "NODE_ENV=production bun run build && bun ../../tools/scripts/prepare-publish.ts .",
34
- "package:publish": "bun run package:prepare && bun publish --access public --no-git-checks && bun install",
35
- "type-check": "bun --bun tsc --noEmit",
36
- "type-check:go": "tsgo"
29
+ "package:publish": "bun ../../tools/scripts/publish-package.ts .",
30
+ "type-check": "bun --bun tsc --noEmit"
37
31
  },
38
32
  "type": "module",
39
33
  "types": "src/cli.ts",
40
- "version": "0.4.8"
34
+ "version": "0.5.1"
41
35
  }
package/schema.json DELETED
@@ -1,112 +0,0 @@
1
- {
2
- "$id": "https://raw.githubusercontent.com/r5n-labs/clis/refs/heads/develop/packages/cli/sisyphus/schema.json",
3
- "$ref": "#/definitions/SisyphusConfig",
4
- "$schema": "http://json-schema.org/draft-07/schema#",
5
- "definitions": {
6
- "SisyphusConfig": {
7
- "additionalProperties": false,
8
- "properties": {
9
- "$schema": {
10
- "default": "https://raw.githubusercontent.com/r5n-labs/clis/refs/heads/develop/packages/cli/sisyphus/schema.json",
11
- "description": "JSON Schema reference for IDE support",
12
- "type": "string"
13
- },
14
- "changelog": {
15
- "additionalProperties": false,
16
- "description": "Changelog configuration",
17
- "properties": {
18
- "generate": {
19
- "default": true,
20
- "description": "If enabled, it will generate a changelog from stones included in release",
21
- "type": "boolean"
22
- },
23
- "root": {
24
- "default": false,
25
- "description": "If enabled, it will generate a combined changelog for monorepo",
26
- "type": "boolean"
27
- }
28
- },
29
- "type": "object"
30
- },
31
- "commit": {
32
- "additionalProperties": false,
33
- "description": "Commit configuration",
34
- "properties": {
35
- "author": { "default": "r5n-bot", "description": "Commit author to use for the release", "type": "string" },
36
- "email": { "description": "Commit email to use for the release", "type": "string" },
37
- "message": {
38
- "default": "release(🎉): <packageName@version>",
39
- "description": "Commit message to use for the release",
40
- "type": "string"
41
- }
42
- },
43
- "type": "object"
44
- },
45
- "configPath": {
46
- "default": ".sisyphus",
47
- "description": "Path to the Sisyphus configuration directory",
48
- "type": "string"
49
- },
50
- "ignore": {
51
- "default": [],
52
- "description": "List of packages to ignore",
53
- "items": { "type": "string" },
54
- "type": "array"
55
- },
56
- "lastStone": {
57
- "additionalProperties": false,
58
- "description": "Last released stone, used to determine a chunk of changes for the next release",
59
- "properties": {
60
- "commit": { "description": "Commit hash of the last stone", "type": "string" },
61
- "date": { "description": "ISO-8601 date of the last stone", "type": "string" }
62
- },
63
- "required": ["commit", "date"],
64
- "type": "object"
65
- },
66
- "release": {
67
- "additionalProperties": false,
68
- "description": "Release configuration",
69
- "properties": {
70
- "commitAndPush": {
71
- "default": false,
72
- "description": "If enabled, it will commit the release and push it to the remote repository",
73
- "type": "boolean"
74
- },
75
- "github": {
76
- "default": false,
77
- "description": "If enabled, it will create a release on GitHub",
78
- "type": "boolean"
79
- },
80
- "npm": {
81
- "default": false,
82
- "description": "If enabled, it will publish packages to NPM",
83
- "type": "boolean"
84
- },
85
- "tags": {
86
- "default": false,
87
- "description": "If enabled, it will create tags for the release",
88
- "type": "boolean"
89
- }
90
- },
91
- "type": "object"
92
- },
93
- "single": {
94
- "default": false,
95
- "description": "If enabled, it will work for root package.json only",
96
- "type": "boolean"
97
- },
98
- "stones": {
99
- "default": [],
100
- "description": "List of stones to use in next release",
101
- "items": { "type": "string" },
102
- "type": "array"
103
- },
104
- "tag": { "default": "latest", "description": "Tag to use for the release", "type": "string" }
105
- },
106
- "required": ["lastStone"],
107
- "type": "object"
108
- }
109
- },
110
- "description": "Schema for Sisyphus versioning tool configuration files",
111
- "title": "Sisyphus Configuration Schema"
112
- }