-
Notifications
You must be signed in to change notification settings - Fork 3
206 lines (174 loc) · 6.54 KB
/
Copy pathupdate-versions.yml
File metadata and controls
206 lines (174 loc) · 6.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
name: Update Buildpack and Run Image Versions
on:
workflow_dispatch:
inputs:
version:
description: New release version (e.g. 0.46.0)
type: string
required: true
pull_request:
types: [closed]
jobs:
validate-tag:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
outputs:
repo_lower: ${{ steps.lowercase_repo.outputs.REPO }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if tag exists
run: |
if git tag -l | grep -q "^${{ github.event.inputs.version }}$"; then
echo "Error: Tag ${{ github.event.inputs.version }} already exists"
exit 1
else
echo "Tag ${{ github.event.inputs.version }} does not exist - proceeding"
fi
- name: lowercase REPO
id: lowercase_repo
run: |
echo "REPO=${GITHUB_REPOSITORY@L}" >> "${GITHUB_OUTPUT}"
build-and-push-build-run-images:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
needs: validate-tag
permissions:
contents: read
packages: write
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push run-image
uses: docker/build-push-action@v5
with:
context: ./run-image
file: ./run-image/Dockerfile
platforms: linux/amd64,linux/arm64
target: run
push: true
tags: ghcr.io/${{ needs.validate-tag.outputs.repo_lower }}/run-image:${{ github.event.inputs.version }}
labels: io.buildpacks.base.distro.name=ubuntu,io.buildpacks.base.distro.version=24.04
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push cuda run-image
uses: docker/build-push-action@v5
with:
context: ./run-image
file: ./run-image/Dockerfile
platforms: linux/amd64,linux/arm64
build-args: base_image=nvcr.io/nvidia/cuda-dl-base:25.10-cuda13.0-devel-ubuntu24.04
target: run
push: true
tags: ghcr.io/${{ needs.validate-tag.outputs.repo_lower }}/cuda-run-image:${{ github.event.inputs.version }}
labels: io.buildpacks.base.distro.name=ubuntu,io.buildpacks.base.distro.version=24.04
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push cuda build-image
uses: docker/build-push-action@v5
with:
context: ./run-image
file: ./run-image/Dockerfile
platforms: linux/amd64,linux/arm64
build-args: base_image=nvcr.io/nvidia/cuda-dl-base:25.10-cuda13.0-devel-ubuntu24.04
target: build
push: true
tags: ghcr.io/${{ needs.validate-tag.outputs.repo_lower }}/cuda-build-image:${{ github.event.inputs.version }}
labels: io.buildpacks.base.distro.name=ubuntu,io.buildpacks.base.distro.version=24.04
cache-from: type=gha
cache-to: type=gha,mode=max
create-version-update-pr:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
needs: [validate-tag, build-and-push-build-run-images]
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Update buildpack.toml versions
run: make update-buildpack-versions RELEASE_VERSION=${{ github.event.inputs.version }}
- name: Update builder.toml
run: make update-builder-versions RELEASE_VERSION=${{ github.event.inputs.version }}
- name: update build-image action
run: make update-action-versions RELEASE_VERSION=${{ github.event.inputs.version }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.RENKUBOT_GITHUB_TOKEN }}
commit-message: "chore(release): Update buildpack and run-image versions to ${{ github.event.inputs.version }}"
title: "chore(release): Update versions to ${{ github.event.inputs.version }}"
body: |
Automated version update for release ${{ github.event.inputs.version }}
- Updated buildpack.toml versions
- Updated builder.toml versions
This PR was created automatically by the release workflow.
**Please review and merge to complete the release process.**
branch: update-versions-${{ github.event.inputs.version }}
base: main
delete-branch: true
release:
if: github.event_name == 'pull_request' && github.event.pull_request.merged == true && startsWith(github.head_ref, 'update-versions-')
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Extract version from branch name
id: extract_version
run: |
VERSION=${GITHUB_HEAD_REF#update-versions-}
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Move tag to merged commit
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -f ${{ steps.extract_version.outputs.VERSION }}
git push origin ${{ steps.extract_version.outputs.VERSION }} --force --tags
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: buildpacks/github-actions/setup-pack@v5.9.5
- name: publish buildpacks
run: make publish_buildpacks
- name: publish builders
run: make publish_builders
- name: Create Release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.extract_version.outputs.VERSION }}
name: Release ${{ steps.extract_version.outputs.VERSION }}
generateReleaseNotes: true
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
- name: Cleanup branch
run: |
git push origin --delete update-versions-${{ steps.extract_version.outputs.VERSION }}