Elffuss BraidHub

kikocis/continue public

5fda066adb4e · 3.5 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@v4
22 with:
23 fetch-depth: 0
24 token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
25
26 - name: Setup Node.js
27 uses: actions/setup-node@v3
28 with:
29 node-version: 20
30 registry-url: "https://registry.npmjs.org"
31 always-auth: true
32
33 - name: Install dependencies
34 working-directory: extensions/cli
35 run: npm ci
36 env:
37 NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
38
39 - name: Get current version
40 id: get_version
41 working-directory: extensions/cli
42 run: |
43 # Get the latest version from package.json or npm registry
44 CURRENT_VERSION=$(node -p "require('./package.json').version")
45 if [[ "$CURRENT_VERSION" == "0.0.0-dev" ]]; then
46 # If it's dev version, get latest from npm registry
47 LATEST_VERSION=$(npm view @continuedev/cli version --silent 2>/dev/null || echo "0.0.0")
48 echo "Using latest npm version: $LATEST_VERSION"
49 CURRENT_VERSION=$LATEST_VERSION
50 fi
51
52 # Create beta version with current date
53 DATE_SUFFIX=$(date -u +%Y%m%d)
54 BETA_VERSION="${CURRENT_VERSION}-beta.${DATE_SUFFIX}"
55
56 # Check if this version already exists on npm
57 if npm view @continuedev/cli@$BETA_VERSION version --silent >/dev/null 2>&1; then
58 echo "Version $BETA_VERSION already exists, adding timestamp"
59 # Add hour and minute to make it unique
60 TIMESTAMP_SUFFIX=$(date -u +%Y%m%d.%H%M)
61 BETA_VERSION="${CURRENT_VERSION}-beta.${TIMESTAMP_SUFFIX}"
62 echo "Using timestamped version: $BETA_VERSION"
63 fi
64
65 echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
66 echo "beta_version=$BETA_VERSION" >> $GITHUB_OUTPUT
67 echo "date_suffix=$DATE_SUFFIX" >> $GITHUB_OUTPUT
68
69 - name: Update package.json for beta
70 working-directory: extensions/cli
71 run: |
72 # Update version in package.json
73 npm version ${{ steps.get_version.outputs.beta_version }} --no-git-tag-version
74
75 - name: Build
76 working-directory: extensions/cli
77 run: npm run build
78
79 - name: Publish beta to npm
80 working-directory: extensions/cli
81 env:
82 NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
83 run: |
84 npm publish --tag beta
85 echo "Published beta version: ${{ steps.get_version.outputs.beta_version }}"
86
87 - name: Create beta release on GitHub
88 env:
89 GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
90 run: |
91 # Create a git tag for the beta
92 git config --local user.email "action@github.com"
93 git config --local user.name "GitHub Action"
94 git tag "v${{ steps.get_version.outputs.beta_version }}"
95 git push origin "v${{ steps.get_version.outputs.beta_version }}"
96
97 # Create GitHub release
98 gh release create "v${{ steps.get_version.outputs.beta_version }}" \
99 --title "Beta Release v${{ steps.get_version.outputs.beta_version }}" \
100 --notes "Daily beta release for testing. This version will be promoted to stable after 7 days if no critical issues are found." \
101 --prerelease