Skip to content

Commit 6da99a4

Browse files
Cut a new release automatically each month (#4146)
- **PR Description** I regularly struggle to stay on top of releases, and that's because I like to spend some time polishing the release notes and I don't always have time for that. But that shouldn't block releases, so now releases will happen automatically on the first Saturday of each month. In order to block an automatic release, we simply need to add a blocks-release label on any open PR or issue. - **Please check if the PR fulfills these requirements** * [ ] Cheatsheets are up-to-date (run `go generate ./...`) * [ ] Code has been formatted (see [here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#code-formatting)) * [ ] Tests have been added/updated (see [here](https://github.com/jesseduffield/lazygit/blob/master/pkg/integration/README.md) for the integration test guide) * [ ] Text is internationalised (see [here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#internationalisation)) * [ ] If a new UserConfig entry was added, make sure it can be hot-reloaded (see [here](https://github.com/jesseduffield/lazygit/blob/master/docs/dev/Codebase_Guide.md#using-userconfig)) * [ ] Docs have been updated if necessary * [ ] You've read through your own file changes for silly mistakes etc <!-- Be sure to name your PR with an imperative e.g. 'Add worktrees view' see https://github.com/jesseduffield/lazygit/releases/tag/v0.40.0 for examples -->
2 parents 91cb1ff + 977a011 commit 6da99a4

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

.github/workflows/release.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Automated Release
2+
3+
on:
4+
schedule:
5+
# Runs at 2:00 AM UTC on the first Saturday of every month
6+
- cron: '0 2 * * 6'
7+
workflow_dispatch: # Allow manual triggering of the workflow
8+
9+
jobs:
10+
check-and-release:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout Code
15+
uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Check for changes since last release
20+
run: |
21+
if [ -z "$(git diff --name-only ${{ env.latest_tag }})" ]; then
22+
echo "No changes detected since last release"
23+
exit 1
24+
fi
25+
26+
- name: Check for Blocking Issues/PRs
27+
id: check_blocks
28+
run: |
29+
gh auth setup-git
30+
gh auth status
31+
32+
echo "Checking for blocking issues and PRs..."
33+
34+
# Check for blocking issues
35+
blocking_issues=$(gh issue list -l blocks-release --json number,title --jq '.[] | "- \(.title) (#\(.number))"')
36+
37+
# Check for blocking PRs
38+
blocking_prs=$(gh pr list -l blocks-release --json number,title --jq '.[] | "- \(.title) (#\(.number)) (PR)"')
39+
40+
# Combine the results
41+
blocking_items="$blocking_issues"$'\n'"$blocking_prs"
42+
43+
# Remove empty lines
44+
blocking_items=$(echo "$blocking_items" | grep . || true)
45+
46+
if [ -n "$blocking_items" ]; then
47+
echo "Blocking issues/PRs detected:"
48+
echo "$blocking_items"
49+
exit 1
50+
fi
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
54+
- name: Calculate next version
55+
run: |
56+
latest_tag=$(git describe --tags $(git rev-list --tags --max-count=1) || echo "v0.0.0")
57+
echo "Latest tag: $latest_tag"
58+
IFS='.' read -r major minor patch <<< "$latest_tag"
59+
new_minor=$((minor + 1))
60+
new_tag="$major.$new_minor.0"
61+
echo "New tag: $new_tag"
62+
echo "new_tag=$new_tag" >> $GITHUB_ENV
63+
64+
# This will trigger a deploy via .github/workflows/cd.yml
65+
- name: Push New Tag
66+
run: |
67+
git config user.name "github-actions[bot]"
68+
git config user.email "github-actions[bot]@users.noreply.github.com"
69+
git tag ${{ env.new_tag }}
70+
git push origin ${{ env.new_tag }}
71+
env:
72+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)