Skip to content

Commit 2289502

Browse files
committed
wip
Signed-off-by: Yuval Turgeman <yturgema@redhat.com>
1 parent 30de13e commit 2289502

2 files changed

Lines changed: 170 additions & 0 deletions

File tree

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Create Release PR
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version_bump:
7+
description: 'Version bump type'
8+
required: true
9+
type: choice
10+
options:
11+
- patch
12+
- minor
13+
- major
14+
default: 'patch'
15+
16+
jobs:
17+
create-release-pr:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout dev branch
21+
uses: actions/checkout@v4
22+
with:
23+
ref: dev
24+
fetch-depth: 0
25+
26+
- name: Get current version
27+
id: current_version
28+
run: |
29+
version=$(grep '^version:' deploy/helm/rag/Chart.yaml | awk '{print $2}')
30+
echo "version=$version" >> $GITHUB_OUTPUT
31+
32+
- name: Calculate new version
33+
id: new_version
34+
run: |
35+
current="${{ steps.current_version.outputs.version }}"
36+
IFS='.' read -r major minor patch <<< "$current"
37+
38+
case "${{ inputs.version_bump }}" in
39+
major)
40+
new_version="$((major + 1)).0.0"
41+
;;
42+
minor)
43+
new_version="${major}.$((minor + 1)).0"
44+
;;
45+
patch)
46+
new_version="${major}.${minor}.$((patch + 1))"
47+
;;
48+
esac
49+
50+
echo "version=$new_version" >> $GITHUB_OUTPUT
51+
echo "New version will be: $new_version"
52+
53+
- name: Update Chart version
54+
run: |
55+
sed -i "s/^version: .*/version: ${{ steps.new_version.outputs.version }}/" deploy/helm/rag/Chart.yaml
56+
sed -i "s/^appVersion: .*/appVersion: \"${{ steps.new_version.outputs.version }}\"/" deploy/helm/rag/Chart.yaml
57+
58+
- name: Commit version bump
59+
run: |
60+
git config user.name "github-actions[bot]"
61+
git config user.email "github-actions[bot]@users.noreply.github.com"
62+
git checkout -b release/v${{ steps.new_version.outputs.version }}
63+
git add deploy/helm/rag/Chart.yaml
64+
git commit -m "chore: bump version to ${{ steps.new_version.outputs.version }}"
65+
git push origin release/v${{ steps.new_version.outputs.version }}
66+
67+
- name: Create Pull Request
68+
env:
69+
GH_TOKEN: ${{ github.token }}
70+
run: |
71+
gh pr create \
72+
--title "Release v${{ steps.new_version.outputs.version }}" \
73+
--body "$(cat <<'EOF'
74+
## Release v${{ steps.new_version.outputs.version }}
75+
76+
This PR merges changes from \`dev\` to \`main\` for release v${{ steps.new_version.outputs.version }}.
77+
78+
### Changes
79+
$(git log main..dev --oneline --no-merges | head -20)
80+
81+
### Checklist
82+
- [ ] All tests passing
83+
- [ ] Documentation updated
84+
- [ ] Breaking changes documented (if any)
85+
86+
After merging, this will automatically:
87+
- Create git tag v${{ steps.new_version.outputs.version }}
88+
- Build and push Docker images
89+
EOF
90+
)" \
91+
--base main \
92+
--head release/v${{ steps.new_version.outputs.version }}

.github/workflows/release.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Release
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches:
7+
- main
8+
9+
jobs:
10+
release:
11+
if: |
12+
github.event.pull_request.merged == true &&
13+
startsWith(github.event.pull_request.head.ref, 'release/')
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
include:
18+
- name: llamastack-dist-ui
19+
context: frontend
20+
chart: deploy/helm/rag/Chart.yaml
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Get version from Chart.yaml
28+
id: version
29+
run: |
30+
version=$(grep '^version:' ${{ matrix.chart }} | awk '{print $2}')
31+
echo "value=$version" >> $GITHUB_OUTPUT
32+
33+
- name: Create git tag
34+
run: |
35+
git config user.name "github-actions[bot]"
36+
git config user.email "github-actions[bot]@users.noreply.github.com"
37+
git tag -a "v${{ steps.version.outputs.value }}" -m "Release v${{ steps.version.outputs.value }}" || true
38+
git push origin "v${{ steps.version.outputs.value }}" || true
39+
40+
- name: Install Helm
41+
uses: azure/setup-helm@v4
42+
with:
43+
version: 'latest'
44+
45+
- name: Package Helm chart
46+
run: |
47+
helm package deploy/helm/rag -d .
48+
ls -la rag-*.tgz
49+
50+
- name: Create GitHub Release
51+
env:
52+
GH_TOKEN: ${{ github.token }}
53+
run: |
54+
gh release create "v${{ steps.version.outputs.value }}" \
55+
--title "Release v${{ steps.version.outputs.value }}" \
56+
--notes "Release v${{ steps.version.outputs.value }}" \
57+
--latest \
58+
rag-${{ steps.version.outputs.value }}.tgz || true
59+
60+
- name: Set up Docker Buildx
61+
uses: docker/setup-buildx-action@v3
62+
63+
- name: Log in to Quay.io
64+
uses: docker/login-action@v3
65+
with:
66+
registry: quay.io
67+
username: ${{ secrets.QUAY_USERNAME }}
68+
password: ${{ secrets.QUAY_PASSWORD }}
69+
70+
- name: Build and push
71+
uses: docker/build-push-action@v5
72+
with:
73+
context: ${{ matrix.context }}
74+
file: ${{ matrix.context }}/Containerfile
75+
push: true
76+
tags: quay.io/yuvalturg/${{ matrix.name }}:${{ steps.version.outputs.value }}
77+
build-args: |
78+
IMAGE_TAG=${{ steps.version.outputs.value }}

0 commit comments

Comments
 (0)