mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-10 20:05:50 +02:00
Improve release workflow
1) the cron schedule was wrong: it was doing every saturday, rather than the first saturday of each month. 2) It wasn't triggering a deploy despite pushing a tag because clearly github doesn't want that to happen. Now it triggers a deploy, and it also allows triggering from the UI, letting you specify minor/patch bump and whether to ignore blocking PRs/issues. As such I'm removing support for the old method of pushing the tag. The new way is the only way.
This commit is contained in:
parent
2ceecad381
commit
fcf48c4f08
2 changed files with 57 additions and 44 deletions
35
.github/workflows/cd.yml
vendored
35
.github/workflows/cd.yml
vendored
|
@ -1,35 +0,0 @@
|
||||||
name: Continuous Delivery
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- "v*"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
goreleaser:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Unshallow repo
|
|
||||||
run: git fetch --prune --unshallow
|
|
||||||
- name: Setup Go
|
|
||||||
uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version: 1.22.x
|
|
||||||
- name: Run goreleaser
|
|
||||||
uses: goreleaser/goreleaser-action@v4
|
|
||||||
with:
|
|
||||||
distribution: goreleaser
|
|
||||||
version: v1.17.2
|
|
||||||
args: release --clean
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{secrets.GITHUB_API_TOKEN}}
|
|
||||||
homebrew:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Bump Homebrew formula
|
|
||||||
uses: dawidd6/action-homebrew-bump-formula@v3
|
|
||||||
with:
|
|
||||||
token: ${{secrets.GITHUB_API_TOKEN}}
|
|
||||||
formula: lazygit
|
|
66
.github/workflows/release.yml
vendored
66
.github/workflows/release.yml
vendored
|
@ -1,18 +1,32 @@
|
||||||
name: Automated Release
|
name: Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
# Runs at 2:00 AM UTC on the first Saturday of every month
|
# Runs at 2:00 AM UTC on the first Saturday of every month
|
||||||
- cron: '0 2 1-7 * 6'
|
- cron: '0 2 1-7 * 6'
|
||||||
workflow_dispatch: # Allow manual triggering of the workflow
|
# Allow manual triggering of the workflow
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
version_bump:
|
||||||
|
description: 'Version bump type'
|
||||||
|
type: choice
|
||||||
|
required: true
|
||||||
|
default: 'patch'
|
||||||
|
options:
|
||||||
|
- minor
|
||||||
|
- patch
|
||||||
|
ignore_blocks:
|
||||||
|
description: 'Ignore blocking PRs/issues'
|
||||||
|
type: boolean
|
||||||
|
required: true
|
||||||
|
default: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-and-release:
|
check-and-release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
@ -30,6 +44,7 @@ jobs:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Check for Blocking Issues/PRs
|
- name: Check for Blocking Issues/PRs
|
||||||
|
if: ${{ !inputs.ignore_blocks }}
|
||||||
id: check_blocks
|
id: check_blocks
|
||||||
run: |
|
run: |
|
||||||
gh auth setup-git
|
gh auth setup-git
|
||||||
|
@ -60,14 +75,26 @@ jobs:
|
||||||
- name: Calculate next version
|
- name: Calculate next version
|
||||||
run: |
|
run: |
|
||||||
echo "Latest tag: ${{ env.latest_tag }}"
|
echo "Latest tag: ${{ env.latest_tag }}"
|
||||||
IFS='.' read -r major minor patch <<< "${{ env.latest_tag }}"
|
IFS='.' read -r major minor patch <<< "${env.latest_tag#v}"
|
||||||
new_minor=$((minor + 1))
|
|
||||||
new_tag="$major.$new_minor.0"
|
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
||||||
|
if [[ "${{ inputs.version_bump }}" == "patch" ]]; then
|
||||||
|
patch=$((patch + 1))
|
||||||
|
else
|
||||||
|
minor=$((minor + 1))
|
||||||
|
patch=0
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Default behavior for scheduled runs
|
||||||
|
minor=$((minor + 1))
|
||||||
|
patch=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
new_tag="v$major.$minor.$patch"
|
||||||
echo "New tag: $new_tag"
|
echo "New tag: $new_tag"
|
||||||
echo "new_tag=$new_tag" >> $GITHUB_ENV
|
echo "new_tag=$new_tag" >> $GITHUB_ENV
|
||||||
|
|
||||||
# This will trigger a deploy via .github/workflows/cd.yml
|
- name: Create and Push Tag
|
||||||
- name: Push New Tag
|
|
||||||
run: |
|
run: |
|
||||||
git config user.name "github-actions[bot]"
|
git config user.name "github-actions[bot]"
|
||||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
@ -75,3 +102,24 @@ jobs:
|
||||||
git push origin ${{ env.new_tag }}
|
git push origin ${{ env.new_tag }}
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_API_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_API_TOKEN }}
|
||||||
|
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: 1.22.x
|
||||||
|
|
||||||
|
- name: Run goreleaser
|
||||||
|
uses: goreleaser/goreleaser-action@v4
|
||||||
|
with:
|
||||||
|
distribution: goreleaser
|
||||||
|
version: v1.17.2
|
||||||
|
args: release --clean
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{secrets.GITHUB_API_TOKEN}}
|
||||||
|
|
||||||
|
- name: Bump Homebrew formula
|
||||||
|
uses: dawidd6/action-homebrew-bump-formula@v3
|
||||||
|
with:
|
||||||
|
token: ${{secrets.GITHUB_API_TOKEN}}
|
||||||
|
formula: lazygit
|
||||||
|
tag: ${{env.new_tag}}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue