Elffuss BraidHub

kikocis/continue public

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