Skip to content

Commit dca990a

Browse files
committed
fix: Dockerfile-based versioning to replace semantic-relase
1 parent 878cd44 commit dca990a

2 files changed

Lines changed: 69 additions & 21 deletions

File tree

.github/updatecli/steampipe.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
---
22
name: Bump Steampipe version
33

4+
scms:
5+
github:
6+
kind: github
7+
spec:
8+
user: '{{ requiredEnv "GITHUB_ACTOR" }}'
9+
email: '{{ requiredEnv "GITHUB_ACTOR" }}@users.noreply.github.com'
10+
owner: devops-ia
11+
repository: steampipe
12+
token: '{{ requiredEnv "GITHUB_TOKEN" }}'
13+
branch: main
14+
commitmessage:
15+
title: 'chore: bump steampipe to {{ source "steampipe" }}'
16+
417
sources:
518
steampipe:
619
kind: githubRelease
@@ -16,8 +29,18 @@ targets:
1629
dockerfile:
1730
name: "Update Steampipe version in Dockerfile"
1831
kind: file
32+
scmid: github
1933
sourceid: steampipe
2034
spec:
2135
file: Dockerfile
2236
matchpattern: 'ARG STEAMPIPE_VERSION=.*'
2337
replacepattern: 'ARG STEAMPIPE_VERSION={{ source "steampipe" }}'
38+
39+
actions:
40+
pr:
41+
kind: github/pullrequest
42+
scmid: github
43+
title: 'chore: bump steampipe to {{ source "steampipe" }}'
44+
spec:
45+
labels:
46+
- dependencies

.github/workflows/docker-build.yml

Lines changed: 46 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -176,30 +176,53 @@ jobs:
176176
artifact-metadata: write
177177
contents: write
178178
id-token: write
179-
issues: write
180179
packages: write
181-
pull-requests: write
182180

183181
steps:
184182
- name: Checkout
185183
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
186184
with:
187185
fetch-depth: 0
188186

189-
- name: Semantic Release
190-
id: semantic
191-
uses: cycjimmy/semantic-release-action@b12c8f6015dc215fe37bc154d4ad456dd3833c90 # v6.0.0
192-
with:
193-
tag_format: 'v${version}'
194-
extra_plugins: |
195-
@semantic-release/changelog
196-
@semantic-release/git
187+
- name: Get Steampipe version
188+
id: version
189+
run: |
190+
VERSION=$(grep -oP 'ARG STEAMPIPE_VERSION=\K.*' Dockerfile)
191+
TAG="v${VERSION}"
192+
echo "version=${VERSION}" >> "${GITHUB_OUTPUT}"
193+
echo "tag=${TAG}" >> "${GITHUB_OUTPUT}"
194+
if git rev-parse "${TAG}" >/dev/null 2>&1; then
195+
echo "is_new=false" >> "${GITHUB_OUTPUT}"
196+
echo "Tag ${TAG} already exists — skipping release"
197+
else
198+
echo "is_new=true" >> "${GITHUB_OUTPUT}"
199+
echo "New version detected: ${TAG}"
200+
fi
201+
202+
- name: Create release tag
203+
if: steps.version.outputs.is_new == 'true'
204+
run: |
205+
git config user.name "github-actions[bot]"
206+
git config user.email "github-actions[bot]@users.noreply.github.com"
207+
git tag -a "${{ steps.version.outputs.tag }}" \
208+
-m "Release ${{ steps.version.outputs.tag }}"
209+
git push origin "${{ steps.version.outputs.tag }}"
210+
env:
211+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
212+
213+
- name: Create GitHub Release
214+
if: steps.version.outputs.is_new == 'true'
215+
run: |
216+
gh release create "${{ steps.version.outputs.tag }}" \
217+
--title "${{ steps.version.outputs.tag }}" \
218+
--generate-notes \
219+
--latest
197220
env:
198221
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
199222

200223
- name: Set Docker metadata
201224
id: meta
202-
if: steps.semantic.outputs.new_release_published == 'true'
225+
if: steps.version.outputs.is_new == 'true'
203226
uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0
204227
with:
205228
images: |
@@ -211,18 +234,18 @@ jobs:
211234
org.opencontainers.image.description='Steampipe CLI — Use SQL to query cloud APIs'
212235
org.opencontainers.image.vendor='devops-ia'
213236
tags: |
214-
type=raw,value=${{ steps.semantic.outputs.new_release_git_tag }}
237+
type=raw,value=${{ steps.version.outputs.tag }}
215238
216239
- name: Set up QEMU
217-
if: steps.semantic.outputs.new_release_published == 'true'
240+
if: steps.version.outputs.is_new == 'true'
218241
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
219242

220243
- name: Set up Docker Buildx
221-
if: steps.semantic.outputs.new_release_published == 'true'
244+
if: steps.version.outputs.is_new == 'true'
222245
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
223246

224247
- name: Cache Docker layers
225-
if: steps.semantic.outputs.new_release_published == 'true'
248+
if: steps.version.outputs.is_new == 'true'
226249
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
227250
with:
228251
path: /tmp/.buildx-cache
@@ -231,14 +254,15 @@ jobs:
231254
${{ runner.os }}-buildx-
232255
233256
- name: "[DOCKERHUB] Log in"
234-
if: steps.semantic.outputs.new_release_published == 'true'
257+
if: steps.version.outputs.is_new == 'true'
235258
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
236259
with:
237260
username: ${{ secrets.DOCKERHUB_USERNAME }}
238261
password: ${{ secrets.DOCKERHUB_PASSWORD }}
239262

240263
- name: "[GHCR] Log in"
241-
if: steps.semantic.outputs.new_release_published == 'true'
264+
if: steps.version.outputs.is_new == 'true'
265+
continue-on-error: true
242266
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
243267
with:
244268
registry: ${{ env.GHCR_REGISTRY }}
@@ -247,7 +271,7 @@ jobs:
247271

248272
- name: Build and push Docker image
249273
id: push
250-
if: steps.semantic.outputs.new_release_published == 'true'
274+
if: steps.version.outputs.is_new == 'true'
251275
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
252276
with:
253277
cache-from: type=local,src=/tmp/.buildx-cache
@@ -260,23 +284,24 @@ jobs:
260284
tags: ${{ steps.meta.outputs.tags }}
261285

262286
- name: "[DOCKERHUB] Update registry description"
263-
if: steps.semantic.outputs.new_release_published == 'true'
287+
if: steps.version.outputs.is_new == 'true'
264288
uses: peter-evans/dockerhub-description@1b9a80c056b620d92cedb9d9b5a223409c68ddfa # v5.0.0
265289
with:
266290
username: ${{ secrets.DOCKERHUB_USERNAME }}
267291
password: ${{ secrets.DOCKERHUB_PASSWORD }}
268292
repository: ${{ env.DOCKERHUB_USER }}/${{ env.DOCKERHUB_REPO }}
269293

270294
- name: "[GHCR] Generate artifact attestation"
271-
if: steps.semantic.outputs.new_release_published == 'true'
295+
if: steps.version.outputs.is_new == 'true'
296+
continue-on-error: true
272297
uses: actions/attest@59d89421af93a897026c735860bf21b6eb4f7b26 # v4.1.0
273298
with:
274299
subject-name: ${{ env.GHCR_REGISTRY }}/${{ env.GHCR_REPO }}
275300
subject-digest: ${{ steps.push.outputs.digest }}
276301
push-to-registry: true
277302

278303
- name: Move Docker cache
279-
if: steps.semantic.outputs.new_release_published == 'true'
304+
if: steps.version.outputs.is_new == 'true'
280305
run: |
281306
rm -rf /tmp/.buildx-cache
282307
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

0 commit comments

Comments
 (0)