Elffuss BraidHub

kikocis/continue public

main · 4.0 KiBRawPermalink
1name: Legacy Release (Deprecated)
2
3on:
4 # schedule:
5 # # Run every day at 9am UTC
6 # - cron: "0 9 * * *"
7 workflow_dispatch:
8 # Keep manual triggering for emergencies
9
10permissions:
11 contents: write
12 issues: write
13 pull-requests: write
14
15jobs:
16 release:
17 name: 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: Check beta version age
39 # run: |
40 # echo "Checking if any beta versions are less than 7 days old..."
41
42 # # Get all beta versions from npm
43 # BETA_VERSIONS=$(npm view @continuedev/cli versions --json | jq -r '.[] | select(contains("-beta."))' 2>/dev/null || echo "[]")
44
45 # if [ "$BETA_VERSIONS" = "[]" ] || [ -z "$BETA_VERSIONS" ]; then
46 # echo "No beta versions found, proceeding with release"
47 # exit 0
48 # fi
49
50 # # Current date in seconds since epoch
51 # CURRENT_DATE=$(date +%s)
52 # SEVEN_DAYS_AGO=$((CURRENT_DATE - 7 * 24 * 60 * 60))
53
54 # # Check each beta version
55 # echo "$BETA_VERSIONS" | while read -r version; do
56 # if [ -z "$version" ]; then
57 # continue
58 # fi
59
60 # echo "Checking version: $version"
61
62 # # Extract date from beta version (format: X.Y.Z-beta.YYYYMMDD or X.Y.Z-beta.YYYYMMDD.HHMM)
63 # DATE_PART=$(echo "$version" | sed -n 's/.*-beta\.\([0-9]\{8\}\).*/\1/p')
64
65 # if [ -z "$DATE_PART" ]; then
66 # echo "Could not extract date from version $version, skipping"
67 # continue
68 # fi
69
70 # # Convert YYYYMMDD to epoch seconds (assuming midnight UTC)
71 # YEAR=${DATE_PART:0:4}
72 # MONTH=${DATE_PART:4:2}
73 # DAY=${DATE_PART:6:2}
74
75 # # Validate date components
76 # if [ ${#YEAR} -ne 4 ] || [ ${#MONTH} -ne 2 ] || [ ${#DAY} -ne 2 ]; then
77 # echo "Invalid date format in version $version, skipping"
78 # continue
79 # fi
80
81 # # Convert to epoch seconds
82 # VERSION_DATE=$(date -d "${YEAR}-${MONTH}-${DAY}" +%s 2>/dev/null || continue)
83
84 # echo "Version $version date: ${YEAR}-${MONTH}-${DAY} (${VERSION_DATE})"
85 # echo "Seven days ago: $(date -d @${SEVEN_DAYS_AGO} '+%Y-%m-%d') (${SEVEN_DAYS_AGO})"
86
87 # # Check if beta version is less than 7 days old
88 # if [ "$VERSION_DATE" -gt "$SEVEN_DAYS_AGO" ]; then
89 # echo "❌ ERROR: Beta version $version was created on ${YEAR}-${MONTH}-${DAY}, which is less than 7 days ago."
90 # echo "Cannot create a stable release until at least 7 days have passed since the latest beta."
91 # echo "Please wait until $(date -d @$((VERSION_DATE + 7 * 24 * 60 * 60)) '+%Y-%m-%d') before creating a stable release."
92 # exit 1
93 # else
94 # echo "✅ Beta version $version is older than 7 days (created ${YEAR}-${MONTH}-${DAY})"
95 # fi
96 # done
97
98 # echo "All beta versions are at least 7 days old, proceeding with release"
99
100 - name: Install semantic-release and plugins
101 run: npm install -D semantic-release @semantic-release/changelog @semantic-release/git @semantic-release/github @semantic-release/npm
102 env:
103 NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
104
105 - name: Semantic Release
106 id: semantic
107 env:
108 GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
109 NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
110 NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
111 run: npx semantic-release