Skip to content

Commit

Permalink
feat: enhance GitHub Actions workflow to support alpha and stable rel…
Browse files Browse the repository at this point in the history
…eases
  • Loading branch information
bucurdavid committed Feb 14, 2025
1 parent 3f7893c commit dc19ca8
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 33 deletions.
62 changes: 58 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,20 @@ on:
push:
branches:
- main
- develop
workflow_dispatch:
inputs:
release_type:
description: 'Release type (stable/alpha)'
required: true
default: 'stable'
type: choice
options:
- stable
- alpha

permissions:
contents: write # needed for creating releases
contents: write

jobs:
publish-npm:
Expand All @@ -17,18 +27,62 @@ jobs:
with:
node-version: '20.3.x'
registry-url: https://registry.npmjs.org/


- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Set Release Type
id: release_type
run: |
if [[ "${{ github.ref }}" == "refs/heads/develop" ]]; then
echo "type=alpha" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "type=stable" >> $GITHUB_OUTPUT
else
echo "type=${{ inputs.release_type }}" >> $GITHUB_OUTPUT
fi
- name: Install Dependencies
run: |
if [[ "${{ steps.release_type.outputs.type }}" == "alpha" ]]; then
pnpm run preinstall:develop && pnpm install
else
pnpm run preinstall:stable && pnpm install
fi
- name: Build
run: |
if [[ "${{ steps.release_type.outputs.type }}" == "alpha" ]]; then
pnpm run build:develop
else
pnpm run build:stable
fi
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION=v$(node -p "require('./package.json').version")
RELEASE_TYPE="${{ steps.release_type.outputs.type }}"
if [[ "$RELEASE_TYPE" == "alpha" ]]; then
VERSION="${VERSION}-alpha"
fi
echo "Creating release for $VERSION"
gh release create $VERSION \
--title "$VERSION" \
--generate-notes
--generate-notes \
--prerelease $([[ "$RELEASE_TYPE" == "alpha" ]] && echo "true" || echo "false")
- name: Publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access=public
run: |
if [[ "${{ steps.release_type.outputs.type }}" == "alpha" ]]; then
pnpm publish --access=public --tag alpha
else
pnpm publish --access=public
fi
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ cache/
.env
.DS_Store

.dist
26 changes: 0 additions & 26 deletions .turbo/turbo-build.log

This file was deleted.

9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"package.json"
],
"dependencies": {
"@aithranetwork/sdk-aithra-toolkit":"0.0.6",
"@elizaos/core": "workspace:*",
"@aithranetwork/sdk-aithra-toolkit": "0.0.6",
"@elizaos/core": "0.1.9",
"@solana/spl-token": "^0.4.12",
"@solana/web3.js": "1.95.8",
"bs58": "^6.0.0",
Expand All @@ -36,7 +36,10 @@
"tsup": "8.3.5"
},
"scripts": {
"build": "tsup --format esm --dts",
"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))});\"",
"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))});\"",
"build:stable": "tsup --format esm --dts",
"build:develop": "tsup --format esm --dts",
"dev": "tsup --format esm --dts --watch",
"lint": "biome check src/",
"lint:fix": "biome check --apply src/",
Expand Down

0 comments on commit dc19ca8

Please sign in to comment.