mirror of
https://github.com/block/goose.git
synced 2026-07-17 12:56:20 +02:00
119 lines
3.6 KiB
YAML
119 lines
3.6 KiB
YAML
name: Release Workflow
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
bump_type:
|
|
description: 'Type of version bump (minor or patch)'
|
|
required: true
|
|
type: string
|
|
target_branch:
|
|
description: 'Target branch for the pull request'
|
|
required: false
|
|
type: string
|
|
default: 'main'
|
|
secrets:
|
|
ANTHROPIC_API_KEY:
|
|
required: false
|
|
OPENAI_API_KEY:
|
|
required: false
|
|
GOOGLE_API_KEY:
|
|
required: false
|
|
OPENROUTER_API_KEY:
|
|
required: false
|
|
XAI_API_KEY:
|
|
required: false
|
|
TETRATE_API_KEY:
|
|
required: false
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
create-release:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
BUMP_TYPE: ${{ inputs.bump_type }}
|
|
TARGET_BRANCH: ${{ inputs.target_branch }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
|
with:
|
|
ref: ${{ inputs.target_branch }}
|
|
fetch-depth: 0 # to generate complete release log
|
|
|
|
- uses: cashapp/activate-hermit@e49f5cb4dd64ff0b0b659d1d8df499595451155a # v1
|
|
- uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
|
|
|
|
- name: Validate input and set old version
|
|
run: |
|
|
if [[ "$BUMP_TYPE" != "minor" && "$BUMP_TYPE" != "patch" ]]; then
|
|
echo "Error: bump_type must be 'minor' or 'patch'"
|
|
exit 1
|
|
fi
|
|
|
|
- name: install dependencies
|
|
run: |
|
|
sudo apt update -y
|
|
sudo apt install -y libdbus-1-dev gnome-keyring libxcb1-dev
|
|
|
|
- name: create release branch
|
|
env:
|
|
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
|
|
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
|
|
XAI_API_KEY: ${{ secrets.XAI_API_KEY }}
|
|
TETRATE_API_KEY: ${{ secrets.TETRATE_API_KEY }}
|
|
run: |
|
|
PRIOR_VERSION=$(just get-tag-version)
|
|
if [[ "$BUMP_TYPE" == "minor" ]]; then
|
|
VERSION=$(just get-next-minor-version)
|
|
else
|
|
VERSION=$(just get-next-patch-version)
|
|
fi
|
|
|
|
echo "prior_ref=v$PRIOR_VERSION" >> $GITHUB_ENV
|
|
echo "version=$VERSION" >> $GITHUB_ENV
|
|
echo "Version: $VERSION"
|
|
|
|
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
git config --local user.name "github-actions[bot]"
|
|
|
|
just prepare-release $VERSION
|
|
BRANCH_NAME=$(git branch --show-current)
|
|
HEAD_REF=$(git rev-parse HEAD)
|
|
echo "branch_name=$BRANCH_NAME" >> $GITHUB_ENV
|
|
echo "head_ref=$HEAD_REF" >> $GITHUB_ENV
|
|
echo "Branch: $BRANCH_NAME"
|
|
|
|
- name: push release branch
|
|
run: |
|
|
git push origin "${{ env.branch_name }}"
|
|
|
|
- name: Generate release notes
|
|
uses: ./.github/actions/generate-release-pr-body
|
|
with:
|
|
version: ${{ env.version }}
|
|
head_ref: ${{ env.head_ref }}
|
|
prior_ref: ${{ env.prior_ref }}
|
|
|
|
- name: Create Pull Request
|
|
run: |
|
|
PR_URL=$(gh pr create \
|
|
-B "$TARGET_BRANCH" \
|
|
-H "${{ env.branch_name }}" \
|
|
--title "chore(release): release version ${{ env.version }} ($BUMP_TYPE)" \
|
|
--body-file pr_body.txt)
|
|
echo "pr_url=$PR_URL" >> $GITHUB_ENV
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Post release checklist comment
|
|
run: |
|
|
sed 's/{{VERSION}}/${{ env.version }}/g' RELEASE_CHECKLIST.md > checklist_comment.md
|
|
gh pr comment "${{ env.pr_url }}" --body-file checklist_comment.md
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|