Skip to content

Commit 780a189

Browse files
create linear plugin
1 parent d063948 commit 780a189

29 files changed

Lines changed: 3461 additions & 1 deletion

.github/workflows/npm-deploy.yml

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: Publish Package
2+
3+
on:
4+
push:
5+
branches:
6+
- 1.x
7+
workflow_dispatch:
8+
9+
jobs:
10+
verify_version:
11+
runs-on: ubuntu-latest
12+
outputs:
13+
should_publish: ${{ steps.check.outputs.should_publish }}
14+
version: ${{ steps.check.outputs.version }}
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Check if package.json version changed
22+
id: check
23+
run: |
24+
echo "Current branch: ${{ github.ref }}"
25+
26+
# Get current version
27+
CURRENT_VERSION=$(jq -r .version package.json)
28+
echo "Current version: $CURRENT_VERSION"
29+
30+
# Get previous commit hash
31+
git rev-parse HEAD~1 || git rev-parse HEAD
32+
PREV_COMMIT=$(git rev-parse HEAD~1 2>/dev/null || git rev-parse HEAD)
33+
34+
# Check if package.json changed
35+
if git diff --name-only HEAD~1 HEAD | grep "package.json"; then
36+
echo "Package.json was changed in this commit"
37+
38+
# Get previous version if possible
39+
if git show "$PREV_COMMIT:package.json" 2>/dev/null; then
40+
PREV_VERSION=$(git show "$PREV_COMMIT:package.json" | jq -r .version)
41+
echo "Previous version: $PREV_VERSION"
42+
43+
if [ "$CURRENT_VERSION" != "$PREV_VERSION" ]; then
44+
echo "Version changed from $PREV_VERSION to $CURRENT_VERSION"
45+
echo "should_publish=true" >> $GITHUB_OUTPUT
46+
else
47+
echo "Version unchanged"
48+
echo "should_publish=false" >> $GITHUB_OUTPUT
49+
fi
50+
else
51+
echo "First commit with package.json, will publish"
52+
echo "should_publish=true" >> $GITHUB_OUTPUT
53+
fi
54+
else
55+
echo "Package.json not changed in this commit"
56+
echo "should_publish=false" >> $GITHUB_OUTPUT
57+
fi
58+
59+
echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
60+
61+
publish:
62+
needs: verify_version
63+
if: needs.verify_version.outputs.should_publish == 'true'
64+
runs-on: ubuntu-latest
65+
permissions:
66+
contents: write
67+
steps:
68+
- name: Checkout repository
69+
uses: actions/checkout@v4
70+
with:
71+
fetch-depth: 0
72+
73+
- name: Create Git tag
74+
run: |
75+
git config user.name "github-actions[bot]"
76+
git config user.email "github-actions[bot]@users.noreply.github.com"
77+
git tag -a "v${{ needs.verify_version.outputs.version }}" -m "Release v${{ needs.verify_version.outputs.version }}"
78+
git push origin "v${{ needs.verify_version.outputs.version }}"
79+
env:
80+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
82+
- name: Setup Bun
83+
uses: oven-sh/setup-bun@v2
84+
85+
- name: Install dependencies
86+
run: bun install
87+
88+
- name: Build package
89+
run: bun run build
90+
91+
- name: Publish to npm
92+
run: bun publish
93+
env:
94+
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
95+
96+
create_release:
97+
needs: [verify_version, publish]
98+
if: needs.verify_version.outputs.should_publish == 'true'
99+
runs-on: ubuntu-latest
100+
permissions:
101+
contents: write
102+
steps:
103+
- name: Checkout repository
104+
uses: actions/checkout@v4
105+
with:
106+
fetch-depth: 0
107+
108+
- name: Create GitHub Release
109+
uses: softprops/action-gh-release@v2
110+
with:
111+
tag_name: 'v${{ needs.verify_version.outputs.version }}'
112+
name: 'v${{ needs.verify_version.outputs.version }}'
113+
generate_release_notes: true
114+
draft: false
115+
prerelease: false
116+
env:
117+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Dependencies
2+
node_modules/
3+
4+
# Build output
5+
dist/
6+
build/
7+
8+
# Environment files
9+
.env
10+
.env.local
11+
.env.*.local
12+
13+
# IDE files
14+
.idea/
15+
.vscode/
16+
*.swp
17+
*.swo
18+
19+
# OS files
20+
.DS_Store
21+
Thumbs.db
22+
23+
# Logs
24+
*.log
25+
npm-debug.log*
26+
yarn-debug.log*
27+
yarn-error.log*
28+
29+
# Testing
30+
coverage/
31+
.nyc_output/
32+
33+
# TypeScript
34+
*.tsbuildinfo

0 commit comments

Comments
 (0)