Skip to content

Commit 727a03d

Browse files
feat(.github/actions): add new job for weekly release
1 parent e234b49 commit 727a03d

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Weekly Release
2+
3+
on:
4+
# TODO(sambhav-jain-16): enable the schedule after testing manually
5+
# schedule:
6+
# - cron: '0 0 * * 1' # Every Monday at 00:00 UTC
7+
workflow_dispatch:
8+
inputs:
9+
release_type:
10+
description: 'Override bump type: patch, minor, or major (empty = auto-detect from PR bodies)'
11+
required: false
12+
default: ''
13+
14+
permissions:
15+
contents: write
16+
17+
concurrency:
18+
group: release
19+
cancel-in-progress: false
20+
21+
jobs:
22+
release:
23+
name: Create Release
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
29+
30+
- name: Check for new commits since last tag
31+
id: check
32+
run: |
33+
LATEST=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
34+
if [ -z "$LATEST" ]; then
35+
COUNT=$(git rev-list HEAD --count)
36+
else
37+
COUNT=$(git rev-list "${LATEST}..HEAD" --count)
38+
fi
39+
if [ "$COUNT" -gt 0 ]; then
40+
echo "has_changes=true" >> "$GITHUB_OUTPUT"
41+
else
42+
echo "has_changes=false" >> "$GITHUB_OUTPUT"
43+
echo "No commits since ${LATEST}, skipping release."
44+
fi
45+
46+
- name: Bump version and create tag
47+
id: tag
48+
if: steps.check.outputs.has_changes == 'true'
49+
uses: mathieudutour/github-tag-action@v6.2
50+
with:
51+
github_token: ${{ secrets.GITHUB_TOKEN }}
52+
default_bump: ${{ github.event.inputs.release_type || 'patch' }}
53+
major_string_token: 'release-type: major'
54+
minor_string_token: 'release-type: minor'
55+
patch_string_token: 'release-type: patch'
56+
with_v: true
57+
release_branches: master
58+
59+
- name: Create GitHub release
60+
if: steps.check.outputs.has_changes == 'true'
61+
uses: softprops/action-gh-release@v3
62+
with:
63+
tag_name: ${{ steps.tag.outputs.new_tag }}
64+
name: Release ${{ steps.tag.outputs.new_tag }}
65+
generate_release_notes: true
66+
67+
- name: No new commits, skipping release
68+
if: steps.check.outputs.has_changes == 'false'
69+
run: echo "Skipping — no commits since last tag."

0 commit comments

Comments
 (0)