Skip to content

Commit cbad923

Browse files
committed
feat(atcions): add create-release-draft action
1 parent 50360e9 commit cbad923

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Create release draft
2+
on:
3+
workflow_dispatch:
4+
pull_request:
5+
branches:
6+
- 'release-*'
7+
8+
jobs:
9+
create-draft:
10+
name: Create release draft
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Get version
17+
id: version
18+
run: |
19+
echo version=$(cat VERSION) >> $GITHUB_OUTPUT
20+
21+
- name: Setup Golang
22+
uses: actions/setup-go@v5
23+
with:
24+
go-version: '1.22'
25+
26+
- name: Build binaries
27+
id: binaries
28+
run: |
29+
make release-binaries
30+
31+
- name: Create release draft
32+
id: create-release
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
run: |
36+
gh release create "v${{ steps.version.outputs.version }}" \
37+
--title "v${{ steps.version.outputs.version }}" \
38+
--generate-notes \
39+
--draft \
40+
dist/release/*

hack/create-release-pr.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
3+
RELEASE_BRANCH="$(git rev-parse --abbrev-ref HEAD || true)"
4+
set -eux
5+
set -o pipefail
6+
7+
### look for latest on-branch tag
8+
PREVIOUS_TAG=$(git describe --tags --abbrev=0 --match "*${RELEASE_BRANCH##release-}*" 2>/dev/null || true)
9+
10+
if [ -n "$PREVIOUS_TAG" ]; then
11+
NEW_VERSION=$(semver-cli inc patch $PREVIOUS_TAG)
12+
else
13+
NEW_VERSION="${RELEASE_BRANCH##release-}.0"
14+
fi
15+
16+
echo $NEW_VERSION > VERSION
17+
18+
IMAGE_TAG="v${NEW_VERSION}"
19+
make manifests
20+
21+
git checkout -b "feat/new-version-${NEW_VERSION}"
22+
git commit -m "Release ${NEW_VERSION}" VERSION manifests/
23+
git push
24+
gh label --repo $(git remote get-url origin) create --force release
25+
gh pr --repo $(git remote get-url origin) \
26+
create \
27+
--base ${RELEASE_BRANCH} \
28+
--title "Release ${NEW_VERSION}" \
29+
--body "Release ${NEW_VERSION}" \
30+
--label release
31+
git checkout -

0 commit comments

Comments
 (0)