gitshift 1.0.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/.github/workflows/publish.yml +103 -0
- package/package.json +26 -0
- package/src/server.js +0 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
name: Publish Package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
paths:
|
|
8
|
+
- package.json
|
|
9
|
+
- package-lock.json
|
|
10
|
+
- src/**
|
|
11
|
+
- .github/workflows/publish-root.yml
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
publish:
|
|
15
|
+
if: ${{ github.event_name == 'push' && !contains(github.event.head_commit.message, '[skip ci]') }}
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
permissions:
|
|
18
|
+
contents: write
|
|
19
|
+
packages: write
|
|
20
|
+
|
|
21
|
+
defaults:
|
|
22
|
+
run:
|
|
23
|
+
working-directory: .
|
|
24
|
+
|
|
25
|
+
steps:
|
|
26
|
+
- name: Check out repository
|
|
27
|
+
uses: actions/checkout@v4
|
|
28
|
+
with:
|
|
29
|
+
fetch-depth: 0
|
|
30
|
+
persist-credentials: true
|
|
31
|
+
|
|
32
|
+
- name: Set up Node.js
|
|
33
|
+
uses: actions/setup-node@v4
|
|
34
|
+
with:
|
|
35
|
+
node-version: '20'
|
|
36
|
+
registry-url: 'https://registry.npmjs.org'
|
|
37
|
+
always-auth: true
|
|
38
|
+
cache: npm
|
|
39
|
+
cache-dependency-path: package-lock.json
|
|
40
|
+
|
|
41
|
+
- name: Install dependencies
|
|
42
|
+
run: npm ci
|
|
43
|
+
|
|
44
|
+
- name: Determine release type
|
|
45
|
+
id: release_type
|
|
46
|
+
shell: bash
|
|
47
|
+
run: |
|
|
48
|
+
RELEASE_TYPE="patch"
|
|
49
|
+
COMMIT_MESSAGE="${{ github.event.head_commit.message || '' }}"
|
|
50
|
+
|
|
51
|
+
if [[ "$COMMIT_MESSAGE" == *"BREAKING CHANGE"* || "$COMMIT_MESSAGE" == *"!"* ]]; then
|
|
52
|
+
RELEASE_TYPE="major"
|
|
53
|
+
elif [[ "$COMMIT_MESSAGE" == feat:* || "$COMMIT_MESSAGE" == *"feat("* ]]; then
|
|
54
|
+
RELEASE_TYPE="minor"
|
|
55
|
+
elif [[ "$COMMIT_MESSAGE" == refactor:* || "$COMMIT_MESSAGE" == *"refactor("* ]]; then
|
|
56
|
+
RELEASE_TYPE="patch"
|
|
57
|
+
elif [[ "$COMMIT_MESSAGE" == fix:* || "$COMMIT_MESSAGE" == *"fix("* ]]; then
|
|
58
|
+
RELEASE_TYPE="patch"
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
echo "release_type=$RELEASE_TYPE" >> "$GITHUB_OUTPUT"
|
|
62
|
+
|
|
63
|
+
- name: Bump version
|
|
64
|
+
run: npm version "${{ steps.release_type.outputs.release_type }}" --no-git-tag-version
|
|
65
|
+
|
|
66
|
+
- name: Publish to npm
|
|
67
|
+
run: npm publish --access public
|
|
68
|
+
env:
|
|
69
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
70
|
+
|
|
71
|
+
- name: Commit version bump
|
|
72
|
+
run: |
|
|
73
|
+
git config user.name "github-actions[bot]"
|
|
74
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
75
|
+
git add package.json package-lock.json
|
|
76
|
+
git commit -m "chore(release): bump package version [skip ci]"
|
|
77
|
+
git push
|
|
78
|
+
|
|
79
|
+
- name: Get version
|
|
80
|
+
id: get_version
|
|
81
|
+
shell: bash
|
|
82
|
+
run: |
|
|
83
|
+
VERSION=$(node -p 'require("./package.json").version')
|
|
84
|
+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
85
|
+
|
|
86
|
+
- name: Tag release and push tag
|
|
87
|
+
run: |
|
|
88
|
+
git config user.name "github-actions[bot]"
|
|
89
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
90
|
+
VERSION=$(node -p "require('./package.json').version")
|
|
91
|
+
TAG=v${VERSION}
|
|
92
|
+
echo "Creating tag $TAG"
|
|
93
|
+
git tag $TAG
|
|
94
|
+
git push origin $TAG
|
|
95
|
+
|
|
96
|
+
- name: Create GitHub release
|
|
97
|
+
uses: actions/create-release@v1
|
|
98
|
+
with:
|
|
99
|
+
tag_name: v${{ steps.get_version.outputs.version }}
|
|
100
|
+
release_name: ${{ github.event.repository.name }} v${{ steps.get_version.outputs.version }}
|
|
101
|
+
body: Automated release from CI for version ${{ steps.get_version.outputs.version }}
|
|
102
|
+
env:
|
|
103
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gitshift",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "GitHub Account Switcher CLI",
|
|
5
|
+
"main": "server.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"gitshift": "./src/server.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
11
|
+
"start": "node src/server.js"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [],
|
|
14
|
+
"author": "",
|
|
15
|
+
"license": "ISC",
|
|
16
|
+
"type": "module",
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@inquirer/prompts": "^8.5.1",
|
|
19
|
+
"chalk": "^5.6.2",
|
|
20
|
+
"commander": "^15.0.0",
|
|
21
|
+
"conf": "^15.1.0",
|
|
22
|
+
"execa": "^9.6.1",
|
|
23
|
+
"fs-extra": "^11.3.5",
|
|
24
|
+
"ora": "^9.4.0"
|
|
25
|
+
}
|
|
26
|
+
}
|
package/src/server.js
ADDED
|
File without changes
|