Elffuss BraidHub

kikocis/continue public

e31fcddb0dec · 3.8 KiBRawPermalink
1name: Beta Release
2
3on:
4 schedule:
5 # Run every day at 9am UTC
6 - cron: "0 9 * * *"
7 workflow_dispatch:
8 # Allow manual triggering
9
10permissions:
11 contents: write
12 issues: write
13 pull-requests: write
14
15jobs:
16 beta-release:
17 name: Beta Release
18 runs-on: ubuntu-latest
19 steps:
20 - name: Checkout
21 uses: actions/checkout@v5
22 with:
23 fetch-depth: 0
24 token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
25
26 - name: Setup Node.js
27 uses: actions/setup-node@v5
28 with:
29 node-version: 20
30 registry-url: "https://registry.npmjs.org"
31 always-auth: true
32
33 - name: Setup packages
34 uses: ./.github/actions/setup-packages
35
36 - name: Setup core component
37 uses: ./.github/actions/setup-component
38 with:
39 component: core
40 include-root: true
41
42 - name: Build core
43 run: |
44 cd core
45 npm run build
46
47 - name: Install CLI dependencies
48 working-directory: extensions/cli
49 run: npm ci
50 env:
51 NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
52
53 - name: Get current version
54 id: get_version
55 working-directory: extensions/cli
56 run: |
57 # Get the latest version from package.json or npm registry
58 CURRENT_VERSION=$(node -p "require('./package.json').version")
59 if [[ "$CURRENT_VERSION" == "0.0.0-dev" ]]; then
60 # If it's dev version, get latest from npm registry
61 LATEST_VERSION=$(npm view @continuedev/cli version --silent 2>/dev/null || echo "0.0.0")
62 echo "Using latest npm version: $LATEST_VERSION"
63 CURRENT_VERSION=$LATEST_VERSION
64 fi
65
66 # Create beta version with current date
67 DATE_SUFFIX=$(date -u +%Y%m%d)
68 BETA_VERSION="${CURRENT_VERSION}-beta.${DATE_SUFFIX}"
69
70 # Check if this version already exists on npm
71 if npm view @continuedev/cli@$BETA_VERSION version --silent >/dev/null 2>&1; then
72 echo "Version $BETA_VERSION already exists, adding timestamp"
73 # Add hour and minute to make it unique
74 TIMESTAMP_SUFFIX=$(date -u +%Y%m%d.%H%M)
75 BETA_VERSION="${CURRENT_VERSION}-beta.${TIMESTAMP_SUFFIX}"
76 echo "Using timestamped version: $BETA_VERSION"
77 fi
78
79 echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
80 echo "beta_version=$BETA_VERSION" >> $GITHUB_OUTPUT
81 echo "date_suffix=$DATE_SUFFIX" >> $GITHUB_OUTPUT
82
83 - name: Update package.json for beta
84 working-directory: extensions/cli
85 run: |
86 # Update version in package.json
87 npm version ${{ steps.get_version.outputs.beta_version }} --no-git-tag-version
88
89 - name: Build
90 working-directory: extensions/cli
91 run: npm run build
92
93 - name: Publish beta to npm
94 working-directory: extensions/cli
95 env:
96 NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
97 run: |
98 npm publish --tag beta
99 echo "Published beta version: ${{ steps.get_version.outputs.beta_version }}"
100
101 - name: Create beta release on GitHub
102 env:
103 GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
104 run: |
105 # Create a git tag for the beta
106 git config --local user.email "action@github.com"
107 git config --local user.name "GitHub Action"
108 git tag "v${{ steps.get_version.outputs.beta_version }}"
109 git push origin "v${{ steps.get_version.outputs.beta_version }}"
110
111 # Create GitHub release
112 gh release create "v${{ steps.get_version.outputs.beta_version }}" \
113 --title "Beta Release v${{ steps.get_version.outputs.beta_version }}" \
114 --notes "Daily beta release for testing. This version will be promoted to stable after 7 days if no critical issues are found." \
115 --prerelease