Skip to content

Commit dc19ca8

Browse files
committed
feat: enhance GitHub Actions workflow to support alpha and stable releases
1 parent 3f7893c commit dc19ca8

File tree

4 files changed

+65
-33
lines changed

4 files changed

+65
-33
lines changed

.github/workflows/publish.yml

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,20 @@ on:
33
push:
44
branches:
55
- main
6+
- develop
67
workflow_dispatch:
8+
inputs:
9+
release_type:
10+
description: 'Release type (stable/alpha)'
11+
required: true
12+
default: 'stable'
13+
type: choice
14+
options:
15+
- stable
16+
- alpha
717

818
permissions:
9-
contents: write # needed for creating releases
19+
contents: write
1020

1121
jobs:
1222
publish-npm:
@@ -17,18 +27,62 @@ jobs:
1727
with:
1828
node-version: '20.3.x'
1929
registry-url: https://registry.npmjs.org/
20-
30+
31+
- name: Install pnpm
32+
uses: pnpm/action-setup@v2
33+
with:
34+
version: 8
35+
36+
- name: Set Release Type
37+
id: release_type
38+
run: |
39+
if [[ "${{ github.ref }}" == "refs/heads/develop" ]]; then
40+
echo "type=alpha" >> $GITHUB_OUTPUT
41+
elif [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
42+
echo "type=stable" >> $GITHUB_OUTPUT
43+
else
44+
echo "type=${{ inputs.release_type }}" >> $GITHUB_OUTPUT
45+
fi
46+
47+
- name: Install Dependencies
48+
run: |
49+
if [[ "${{ steps.release_type.outputs.type }}" == "alpha" ]]; then
50+
pnpm run preinstall:develop && pnpm install
51+
else
52+
pnpm run preinstall:stable && pnpm install
53+
fi
54+
55+
- name: Build
56+
run: |
57+
if [[ "${{ steps.release_type.outputs.type }}" == "alpha" ]]; then
58+
pnpm run build:develop
59+
else
60+
pnpm run build:stable
61+
fi
62+
2163
- name: Create Release
2264
env:
2365
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2466
run: |
2567
VERSION=v$(node -p "require('./package.json').version")
68+
RELEASE_TYPE="${{ steps.release_type.outputs.type }}"
69+
70+
if [[ "$RELEASE_TYPE" == "alpha" ]]; then
71+
VERSION="${VERSION}-alpha"
72+
fi
73+
2674
echo "Creating release for $VERSION"
2775
gh release create $VERSION \
2876
--title "$VERSION" \
29-
--generate-notes
77+
--generate-notes \
78+
--prerelease $([[ "$RELEASE_TYPE" == "alpha" ]] && echo "true" || echo "false")
3079
3180
- name: Publish
3281
env:
3382
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
34-
run: npm publish --access=public
83+
run: |
84+
if [[ "${{ steps.release_type.outputs.type }}" == "alpha" ]]; then
85+
pnpm publish --access=public --tag alpha
86+
else
87+
pnpm publish --access=public
88+
fi

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ cache/
55
.env
66
.DS_Store
77

8+
.dist

.turbo/turbo-build.log

Lines changed: 0 additions & 26 deletions
This file was deleted.

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
"package.json"
2323
],
2424
"dependencies": {
25-
"@aithranetwork/sdk-aithra-toolkit":"0.0.6",
26-
"@elizaos/core": "workspace:*",
25+
"@aithranetwork/sdk-aithra-toolkit": "0.0.6",
26+
"@elizaos/core": "0.1.9",
2727
"@solana/spl-token": "^0.4.12",
2828
"@solana/web3.js": "1.95.8",
2929
"bs58": "^6.0.0",
@@ -36,7 +36,10 @@
3636
"tsup": "8.3.5"
3737
},
3838
"scripts": {
39-
"build": "tsup --format esm --dts",
39+
"preinstall:stable": "node -e \"const p=require('./package.json');require('child_process').exec('npm view @elizaos/core versions --json',(e,o)=>{const v=JSON.parse(o).filter(v=>!v.includes('alpha')&&!v.includes('beta')).pop();p.dependencies['@elizaos/core']=v;require('fs').writeFileSync('./package.json',JSON.stringify(p,null,2))});\"",
40+
"preinstall:develop": "node -e \"const p=require('./package.json');require('child_process').exec('npm view @elizaos/core versions --json',(e,o)=>{const v=JSON.parse(o).pop();p.dependencies['@elizaos/core']=v;require('fs').writeFileSync('./package.json',JSON.stringify(p,null,2))});\"",
41+
"build:stable": "tsup --format esm --dts",
42+
"build:develop": "tsup --format esm --dts",
4043
"dev": "tsup --format esm --dts --watch",
4144
"lint": "biome check src/",
4245
"lint:fix": "biome check --apply src/",

0 commit comments

Comments
 (0)