-
Notifications
You must be signed in to change notification settings - Fork 12
chore(ci): add automated dated release workflow #333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
imshashank
merged 21 commits into
Noveum:main
from
Andes-indica:ci/auto-release-workflow
Aug 25, 2026
Merged
Changes from 6 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
5e3c574
chore(ci):add automated dated release workflow
Andes-indica 282c579
updated docs
Andes-indica 941706e
chore(ci): fix release workflow f-string and update docs
Andes-indica 10892c7
ci: add workflow_dispatch to auto-release for manual testing
Andes-indica 2b95956
ci: fix release step GITHUB_TOKEN and use
Andes-indica 97095c0
ci: pin actions/checkout to full commit SHA
Andes-indica 1f4024b
ci: auto-release - migrate notes to Bun TS, fix lint/format; adjust w…
Andes-indica 877f28c
ci(workflows): pin oven-sh/setup-bun v2 to commit SHA in auto-release…
Andes-indica a1a0719
ci:resolved since-declaration causing the test error
Andes-indica 337fb92
ci:resolved tag format error
Andes-indica b8f6fc3
ci:fix release retry boundary and orphan tag handling
Andes-indica fa29954
fix release retry and orphan tag recovery
Andes-indica 7ecc729
Merge branch 'Noveum:main' into ci/auto-release-workflow
Andes-indica 7585b19
ci:fix automated release workflow contract
Andes-indica 2517e9f
Merge branch 'Noveum:main' into ci/auto-release-workflow
Andes-indica 9cb3df4
fix release workflow orphan recovery
Andes-indica a3021d3
fix automated release workflow wiring
Andes-indica 6d9ca76
docs: align automated release guidance
imshashank 1da4666
fix(ci): recover prior dated release tags
imshashank c4c6d60
fix(ci): recover historical dated releases
imshashank 1e0fa1e
fix(ci): avoid overlapping recovery notes
imshashank File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,145 @@ | ||
| name: Automated Releases | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| schedule: | ||
| - cron: '0 0 * * 0' | ||
| workflow_dispatch: | ||
| concurrency: | ||
| group: automated-release | ||
| cancel-in-progress: true | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: read | ||
|
|
||
| jobs: | ||
| tag-and-release: | ||
| name: Create dated tag and release notes | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
|
Andes-indica marked this conversation as resolved.
Outdated
|
||
| uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 | ||
| with: | ||
| fetch-depth: 0 | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| - name: Configure git | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
|
|
||
| - name: Determine last tag and since | ||
| id: since | ||
| run: | | ||
| set -euo pipefail | ||
| # Try to find the latest tag on origin | ||
|
greptile-apps[bot] marked this conversation as resolved.
Outdated
|
||
| git fetch --tags origin | ||
| LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || true) | ||
| if [ -n "$LAST_TAG" ]; then | ||
| SINCE_DATE=$(git log -1 --format=%aI "$LAST_TAG") | ||
| echo "Found last tag: $LAST_TAG (since $SINCE_DATE)" | ||
| else | ||
| # Fallback to 7 days ago | ||
| SINCE_DATE=$(date -u -d '7 days ago' --iso-8601=seconds) | ||
| echo "No tag found, using fallback since: $SINCE_DATE" | ||
| fi | ||
| echo "last_tag=$LAST_TAG" >> "$GITHUB_OUTPUT" | ||
| echo "since_date=$SINCE_DATE" >> "$GITHUB_OUTPUT" | ||
|
Andes-indica marked this conversation as resolved.
Outdated
|
||
|
|
||
| - name: Build release notes (Python) | ||
| id: build_notes | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
greptile-apps[bot] marked this conversation as resolved.
|
||
| run: | | ||
| python3 - <<'PY' | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
| import os, sys, json, urllib.request, datetime | ||
| repo = os.environ['GITHUB_REPOSITORY'] | ||
| since = os.environ.get('INPUT_SINCE') or os.environ.get('since_date') or os.environ.get('GITHUB_SINCE') | ||
| if not since: | ||
| since = (datetime.datetime.utcnow() - datetime.timedelta(days=7)).isoformat() + 'Z' | ||
| owner, repo_name = repo.split('/') | ||
| token = os.environ.get('GITHUB_TOKEN') | ||
| hdr = {'User-Agent': 'orbit-release-bot', 'Accept': 'application/vnd.github+json'} | ||
| if token: | ||
| hdr['Authorization'] = f'token {token}' | ||
| prs = [] | ||
| page = 1 | ||
| while True: | ||
| url = f'https://api.github.com/repos/{owner}/{repo_name}/pulls?state=closed&per_page=100&page={page}' | ||
| req = urllib.request.Request(url, headers=hdr) | ||
| with urllib.request.urlopen(req) as resp: | ||
| data = json.load(resp) | ||
| if not data: | ||
| break | ||
| prs.extend(data) | ||
| if len(data) < 100: | ||
| break | ||
| page += 1 | ||
|
|
||
| since_dt = datetime.datetime.fromisoformat(since.replace('Z','+00:00')) | ||
| merged = [p for p in prs if p.get('merged_at')] | ||
| merged = [p for p in merged if datetime.datetime.fromisoformat(p['merged_at'].replace('Z','+00:00')) >= since_dt] | ||
|
|
||
| areas = {} | ||
| breaking = [] | ||
| for p in merged: | ||
| labels = [l['name'] for l in p.get('labels',[])] | ||
| if 'breaking change' in labels: | ||
| breaking.append(p) | ||
| continue | ||
| area = next((l for l in labels if l.startswith('area:')), 'Other') | ||
| areas.setdefault(area, []).append(p) | ||
|
|
||
| body = f"Automated release for {os.environ.get('GITHUB_SHA','')}\\n" | ||
|
greptile-apps[bot] marked this conversation as resolved.
Outdated
|
||
| if breaking: | ||
| body += '## Breaking changes\n' | ||
| for pr in breaking: | ||
| body += f"- {pr['title']} (#{pr['number']} {pr['html_url']})\n" | ||
| if pr.get('body'): | ||
| body += '\n ' + '\n '.join(pr['body'].splitlines()[:6]) + '\n' | ||
| body += '\n' | ||
|
|
||
| for area, prs_list in areas.items(): | ||
| title = area.replace('area:', 'Area: ') | ||
| body += f"## {title}\n" | ||
| for pr in prs_list: | ||
| body += f"- {pr['title']} (#{pr['number']} {pr['html_url']})\n" | ||
| body += '\n' | ||
|
|
||
| if not breaking and not areas: | ||
| body += 'No merged pull requests found since the last tag.\n' | ||
|
|
||
| with open('RELEASE_NOTES.md','w') as f: | ||
| f.write(body) | ||
| print('WROTE RELEASE_NOTES.md') | ||
| # write output using the environment file instead of deprecated set-output | ||
| # the step runner will append this to $GITHUB_OUTPUT | ||
| PY | ||
| echo "notes_path=RELEASE_NOTES.md" >> "$GITHUB_OUTPUT" | ||
|
greptile-apps[bot] marked this conversation as resolved.
Outdated
|
||
|
|
||
| - name: Create dated tag | ||
|
Andes-indica marked this conversation as resolved.
Outdated
|
||
| id: create_tag | ||
| run: | | ||
| set -euo pipefail | ||
| BASE_TAG=$(date -u +%Y.%m.%d) | ||
| TAG="$BASE_TAG" | ||
| COUNT=0 | ||
| while git ls-remote --tags origin "refs/tags/$TAG" | grep -q .; do | ||
| COUNT=$((COUNT+1)) | ||
| TAG="$BASE_TAG-$COUNT" | ||
| done | ||
| echo "Tag will be: $TAG" | ||
| git tag -a "$TAG" -m "Automated release $TAG" $GITHUB_SHA | ||
| git push origin "$TAG" | ||
| echo "tag=$TAG" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Create GitHub release | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| set -euo pipefail | ||
| TAG=${{ steps.create_tag.outputs.tag }} | ||
| NOTES=$(cat RELEASE_NOTES.md || echo "No release notes available") | ||
| data=$(jq -n --arg tag "$TAG" --arg name "$TAG" --arg body "$NOTES" '{tag_name:$tag, name:$name, body:$body, draft:false, prerelease:false}') | ||
| curl -sS -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github+json" https://api.github.com/repos/${GITHUB_REPOSITORY}/releases -d "$data" | ||
|
Andes-indica marked this conversation as resolved.
Outdated
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.