Skip to content

Commit 41b6492

Browse files
authored
Merge branch 'master' into improve-documentation
2 parents 7dc59be + f867c50 commit 41b6492

File tree

258 files changed

+25232
-16248
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

258 files changed

+25232
-16248
lines changed

.github/scripts/promote_to_master.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
COMMIT_LIST=$(git log --pretty=format:"* %s (%h) by %an" origin/master..dev |
3+
COMMIT_LIST=$(git log --pretty=format:"* %s (%h) by %an" origin/master..rc |
44
while IFS= read -r line; do
55
if [[ ! $line =~ ^"* feat"* && ! $line =~ ^"* fix"* && ! $line =~ ^"* docs"* ]]; then
66
echo "* chore${line:1}"
@@ -13,19 +13,17 @@ if [ -z "$COMMIT_LIST" ]; then
1313
COMMIT_LIST="No new commits - branches may be identical"
1414
fi
1515
16-
MERGE_DATE="Friday"
16+
MERGE_DATE="1st or 3rd Friday of the month"
1717
1818
echo "$COMMIT_LIST" >commit_list.txt
1919
2020
cat <<EOF >>$GITHUB_ENV
2121
PR_BODY<<EOT
22-
This is an automated PR to promote changes from \`dev\` to \`master\`.
22+
This is an automated PR to promote changes from \`rc\` to \`master\`.
2323
Please review and test before merging.
2424
25-
2625
See [TESTING.md](./TESTING.md) for complete testing instructions.
2726
28-
2927
According to our release policy, this PR is expected to be merged on: **$MERGE_DATE**
3028
Testers are encouraged to test the changes before merging.
3129
Please note that this schedule may be adjusted based on the needs of the project.

.github/scripts/promote_to_rc.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
3+
COMMIT_LIST=$(git log --pretty=format:"* %s (%h) by %an" origin/rc..dev |
4+
while IFS= read -r line; do
5+
if [[ ! $line =~ ^"* feat"* && ! $line =~ ^"* fix"* && ! $line =~ ^"* docs"* ]]; then
6+
echo "* chore${line:1}"
7+
else
8+
echo "$line"
9+
fi
10+
done)
11+
12+
if [ -z "$COMMIT_LIST" ]; then
13+
COMMIT_LIST="No new commits - branches may be identical"
14+
fi
15+
16+
MERGE_DATE="Freeze Week (see release policy)"
17+
18+
echo "$COMMIT_LIST" >commit_list.txt
19+
20+
cat <<EOF >>$GITHUB_ENV
21+
PR_BODY<<EOT
22+
This is an automated PR to promote changes from \`dev\` to \`rc\`.
23+
Please review and test before merging.
24+
25+
See [TESTING.md](./TESTING.md) for complete testing instructions.
26+
27+
According to our release policy, this PR is expected to be merged during: **$MERGE_DATE**
28+
Testers are encouraged to test the changes before merging.
29+
Please note that this schedule may be adjusted based on the needs of the project.
30+
31+
---
32+
$(cat commit_list.txt)
33+
---
34+
35+
Please review the changes carefully before merging.
36+
EOT
37+
EOF

.github/scripts/remind-release.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import calendar
2+
from datetime import date, timedelta
3+
4+
5+
def get_fridays(year, month):
6+
"""Return a list of all Fridays in a given month."""
7+
c = calendar.Calendar()
8+
return [
9+
d
10+
for d in c.itermonthdates(year, month)
11+
if d.weekday() == calendar.FRIDAY and d.month == month
12+
]
13+
14+
15+
def print_release_calendar(year):
16+
print(f"# Bi-monthly Release Calendar for {year}\n")
17+
print(
18+
"| Month | Freeze Week | Merge Friday | Snapshot | Quarter | Tag |"
19+
)
20+
print(
21+
"|-----------|--------------|--------------|--------------|-------|---------|"
22+
)
23+
for month in range(1, 13):
24+
fridays = get_fridays(year, month)
25+
if not fridays:
26+
continue
27+
merge1 = fridays[0] if len(fridays) > 0 else None
28+
snap1 = fridays[1] if len(fridays) > 1 else None
29+
merge2 = fridays[2] if len(fridays) > 2 else None
30+
snap2 = fridays[3] if len(fridays) > 3 else None
31+
freeze1 = merge1 - timedelta(days=7) if merge1 else None
32+
freeze2 = merge2 - timedelta(days=7) if merge2 else None
33+
yy = str(year)[-2:]
34+
m = str(month)
35+
tag1 = f"{yy}.{m}.1" if merge1 else ""
36+
tag3 = f"{yy}.{m}.3" if merge2 else ""
37+
# Print 1st quarter row
38+
print(
39+
f"| {calendar.month_abbr[month]:<9} | "
40+
f"{freeze1.strftime('%Y-%m-%d') if freeze1 else '':<12} | "
41+
f"{merge1.strftime('%Y-%m-%d') if merge1 else '':<12} | "
42+
f"{snap1.strftime('%Y-%m-%d') if snap1 else '':<12} | "
43+
f"{'Q1':<5} | "
44+
f"{tag1:<7} |"
45+
)
46+
# Print 3rd quarter row
47+
if merge2:
48+
print(
49+
f"| {'':<9} | "
50+
f"{freeze2.strftime('%Y-%m-%d') if freeze2 else '':<12} | "
51+
f"{merge2.strftime('%Y-%m-%d') if merge2 else '':<12} | "
52+
f"{snap2.strftime('%Y-%m-%d') if snap2 else '':<12} | "
53+
f"{'Q3':<5} | "
54+
f"{tag3:<7} |"
55+
)
56+
57+
58+
if __name__ == "__main__":
59+
import sys
60+
61+
year = int(sys.argv[1]) if len(sys.argv) > 1 else date.today().year
62+
print_release_calendar(year)

.github/workflows/ci.yml

Lines changed: 146 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,146 @@ on:
44
branches:
55
- dev
66
- master
7+
- rc
78
pull_request:
9+
workflow_dispatch:
810

911
jobs:
10-
dev-to-master-pr:
11-
name: Create or Update PR from Dev to Master
12+
dev-to-rc-pr:
13+
name: Create PR from Dev to RC
1214
if: github.ref == 'refs/heads/dev' && github.repository == 'HyDE-Project/HyDE'
1315
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
# Generate commit history and calculate suggested merge date
22+
- name: Generate commit history and schedule
23+
id: generate-commits
24+
run: |
25+
chmod +x .github/scripts/promote_to_rc.sh
26+
bash .github/scripts/promote_to_rc.sh
27+
28+
# Check if there are any commits between rc and dev
29+
- name: Check for commits between branches
30+
id: check-commits
31+
run: |
32+
# Fetch rc branch to make sure it exists locally
33+
git fetch origin rc:rc || true
34+
35+
# We're already on dev branch since the job runs when dev is pushed
36+
# Compare dev to rc to see if there are any differences
37+
if git rev-parse --verify rc >/dev/null 2>&1; then
38+
COMMIT_COUNT=$(git rev-list --count rc..dev)
39+
echo "commit_count=$COMMIT_COUNT" >> $GITHUB_OUTPUT
40+
if [ "$COMMIT_COUNT" -gt 0 ]; then
41+
echo "Detected $COMMIT_COUNT commit(s) between rc and dev"
42+
echo "has_commits=true" >> $GITHUB_OUTPUT
43+
else
44+
echo "No commits detected between rc and dev"
45+
echo "has_commits=false" >> $GITHUB_OUTPUT
46+
fi
47+
else
48+
echo "RC branch doesn't exist yet. Assuming changes need to be propagated."
49+
echo "commit_count=999" >> $GITHUB_OUTPUT # Use a high number to indicate there are changes
50+
echo "has_commits=true" >> $GITHUB_OUTPUT
51+
fi
52+
53+
# Set up git for potential operations
54+
- name: Setup git
55+
if: steps.check-commits.outputs.has_commits == 'true'
56+
run: |
57+
git config user.name "GitHub Actions Bot"
58+
git config user.email "[email protected]"
59+
60+
# Create or update PR using GitHub API with retry logic
61+
- name: Create or Update Pull Request
62+
if: steps.check-commits.outputs.has_commits == 'true'
63+
uses: actions/github-script@v6
64+
with:
65+
github-token: ${{ secrets.GITHUB_TOKEN }}
66+
script: |
67+
const { repo, owner } = context.repo;
68+
const prBranch = "dev";
69+
const prTitle = "chore: Release - dev → rc";
70+
const prBody = process.env.PR_BODY;
71+
72+
// Retry helper function
73+
async function retryOperation(operation, maxRetries = 3, delay = 5000) {
74+
let lastError;
75+
for (let attempt = 1; attempt <= maxRetries; attempt++) {
76+
try {
77+
return await operation();
78+
} catch (error) {
79+
lastError = error;
80+
console.log(`Attempt ${attempt}/${maxRetries} failed: ${error.message}`);
81+
if (attempt < maxRetries) {
82+
console.log(`Waiting ${delay/1000} seconds before retry...`);
83+
await new Promise(resolve => setTimeout(resolve, delay));
84+
}
85+
}
86+
}
87+
throw lastError;
88+
}
89+
90+
// Check if PR already exists
91+
const prs = await retryOperation(async () => {
92+
return github.rest.pulls.list({
93+
owner,
94+
repo,
95+
head: `${owner}:${prBranch}`,
96+
base: 'rc',
97+
state: 'open'
98+
});
99+
});
100+
101+
if (prs.data.length > 0) {
102+
// Update existing PR
103+
console.log(`Updating existing PR #${prs.data[0].number}`);
104+
await retryOperation(async () => {
105+
return github.rest.pulls.update({
106+
owner,
107+
repo,
108+
pull_number: prs.data[0].number,
109+
title: prTitle,
110+
body: prBody
111+
});
112+
});
113+
console.log(`PR #${prs.data[0].number} updated successfully.`);
114+
} else {
115+
// Create new PR
116+
try {
117+
const result = await retryOperation(async () => {
118+
return github.rest.pulls.create({
119+
owner,
120+
repo,
121+
title: prTitle,
122+
body: prBody,
123+
head: prBranch,
124+
base: 'rc'
125+
});
126+
});
127+
console.log(`PR created: ${result.data.html_url}`);
128+
} catch (error) {
129+
console.log(`All attempts to create PR failed: ${error.message}`);
130+
// As a fallback, output command for manual PR creation
131+
console.log(`To create the PR manually, visit: https://github.com/${owner}/${repo}/compare/rc...${prBranch}`);
132+
throw error;
133+
}
134+
}
135+
136+
# Output message when no commits are found
137+
- name: No Commits Message
138+
if: steps.check-commits.outputs.has_commits == 'false'
139+
run: |
140+
echo "::notice::No new commits detected between rc and dev branches. Skipping PR creation."
141+
echo "The branches rc and dev are already in sync."
142+
143+
rc-to-master-pr:
144+
name: Create PR from RC to Master
145+
if: github.ref == 'refs/heads/rc' && github.repository == 'HyDE-Project/HyDE'
146+
runs-on: ubuntu-latest
14147
steps:
15148
- uses: actions/checkout@v4
16149
with:
@@ -23,23 +156,23 @@ jobs:
23156
chmod +x .github/scripts/promote_to_master.sh
24157
bash .github/scripts/promote_to_master.sh
25158
26-
# Check if there are any commits between master and dev
159+
# Check if there are any commits between master and rc
27160
- name: Check for commits between branches
28161
id: check-commits
29162
run: |
30163
# Fetch master branch to make sure it exists locally
31164
git fetch origin master:master || true
32165
33-
# We're already on dev branch since the job runs when dev is pushed
34-
# Compare dev to master to see if there are any differences
166+
# We're already on rc branch since the job runs when rc is pushed
167+
# Compare rc to master to see if there are any differences
35168
if git rev-parse --verify master >/dev/null 2>&1; then
36-
COMMIT_COUNT=$(git rev-list --count master..dev)
169+
COMMIT_COUNT=$(git rev-list --count master..rc)
37170
echo "commit_count=$COMMIT_COUNT" >> $GITHUB_OUTPUT
38171
if [ "$COMMIT_COUNT" -gt 0 ]; then
39-
echo "Detected $COMMIT_COUNT commit(s) between master and dev"
172+
echo "Detected $COMMIT_COUNT commit(s) between master and rc"
40173
echo "has_commits=true" >> $GITHUB_OUTPUT
41174
else
42-
echo "No commits detected between master and dev"
175+
echo "No commits detected between master and rc"
43176
echo "has_commits=false" >> $GITHUB_OUTPUT
44177
fi
45178
else
@@ -63,8 +196,8 @@ jobs:
63196
github-token: ${{ secrets.GITHUB_TOKEN }}
64197
script: |
65198
const { repo, owner } = context.repo;
66-
const prBranch = "dev";
67-
const prTitle = "chore: release automated changes from dev to master";
199+
const prBranch = "rc";
200+
const prTitle = "chore: Release - rc → master";
68201
const prBody = process.env.PR_BODY;
69202
70203
// Retry helper function
@@ -125,7 +258,6 @@ jobs:
125258
console.log(`PR created: ${result.data.html_url}`);
126259
} catch (error) {
127260
console.log(`All attempts to create PR failed: ${error.message}`);
128-
129261
// As a fallback, output command for manual PR creation
130262
console.log(`To create the PR manually, visit: https://github.com/${owner}/${repo}/compare/master...${prBranch}`);
131263
throw error;
@@ -136,11 +268,11 @@ jobs:
136268
- name: No Commits Message
137269
if: steps.check-commits.outputs.has_commits == 'false'
138270
run: |
139-
echo "::notice::No new commits detected between master and dev branches. Skipping PR creation."
140-
echo "The branches master and dev are already in sync."
271+
echo "::notice::No new commits detected between master and rc branches. Skipping PR creation."
272+
echo "The branches master and rc are already in sync."
141273
142274
release:
143-
name: release
275+
name: Quarterly Snapshot Release
144276
if: github.ref == 'refs/heads/master' && github.repository == 'HyDE-Project/HyDE'
145277
runs-on: ubuntu-latest
146278
steps:
Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
1-
name: Refresh Release
1+
name: Quarterly Release Refresh
22

33
on:
44
workflow_dispatch:
5-
inputs:
6-
version_bump:
7-
description: "Type of version bump (patch, minor, major)"
8-
required: true
9-
default: "patch"
10-
type: choice
11-
options:
12-
- patch
13-
- minor
14-
- major
155

166
jobs:
177
refresh-release:
@@ -34,19 +24,23 @@ jobs:
3424
git config user.name "GitHub Actions Bot"
3525
git config user.email "[email protected]"
3626
37-
- name: Create conventional commit to trigger release
27+
- name: Create date-based commit to trigger release
3828
run: |
39-
# Create empty commit with appropriate conventional commit message
40-
if [[ "${{ github.event.inputs.version_bump }}" == "minor" ]]; then
41-
git commit --allow-empty -m "feat: trigger new release refresh"
42-
elif [[ "${{ github.event.inputs.version_bump }}" == "major" ]]; then
43-
git commit --allow-empty -m "feat!: trigger major release refresh"
44-
else
45-
git commit --allow-empty -m "fix: trigger patch release refresh"
46-
fi
47-
48-
# Push to master branch
29+
# Use current date for versioning in YY.M.Q format (e.g., 25.7.1 for July 2025, 1st Quarter)
30+
YEAR=$(date +'%y')
31+
MONTH=$(date +'%-m')
32+
# Calculate quarter: 1 for Jan-Mar, 2 for Apr-Jun, 3 for Jul-Sep, 4 for Oct-Dec
33+
case $MONTH in
34+
1|2|3) Q=1 ;;
35+
4|5|6) Q=2 ;;
36+
7|8|9) Q=3 ;;
37+
10|11|12) Q=4 ;;
38+
esac
39+
VERSION_TAG="$YEAR.$MONTH.$Q"
40+
git commit --allow-empty -m "release: trigger quarterly refresh $VERSION_TAG"
41+
git tag -a "$VERSION_TAG" -m "Quarterly release $VERSION_TAG"
4942
git push origin HEAD:master
43+
git push origin "$VERSION_TAG"
5044
5145
- name: Provide feedback
52-
run: echo "Release refresh triggered successfully with a ${{ github.event.inputs.version_bump }} version bump!"
46+
run: echo "Quarterly release refresh triggered successfully with tag $VERSION_TAG!"

0 commit comments

Comments
 (0)