Skip to content

Commit f65b8b1

Browse files
Merge pull request #1 from elizaos-plugins/v2
v2 version of plugin-shell
2 parents b1d4da3 + 843bb40 commit f65b8b1

31 files changed

Lines changed: 2882 additions & 2911 deletions

.github/workflows/npm-deploy.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
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: Create GitHub Release
104+
uses: actions/create-release@v1
105+
env:
106+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107+
with:
108+
tag_name: "v${{ needs.verify_version.outputs.version }}"
109+
release_name: "v${{ needs.verify_version.outputs.version }}"
110+
body: "Release v${{ needs.verify_version.outputs.version }}"
111+
draft: false
112+
prerelease: false

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 ElizaOS Contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)