Skip to content

Commit e9172df

Browse files
authored
Merge pull request #130 from bennyz/tag-release
actions: add release logic
2 parents 2a430f1 + 873ab82 commit e9172df

File tree

1 file changed

+38
-2
lines changed

1 file changed

+38
-2
lines changed

.github/workflows/build.yaml

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
- '*'
77
branches:
88
- main
9+
- 'release-*'
910

1011
env:
1112
REGISTRY: quay.io
@@ -30,6 +31,28 @@ jobs:
3031
echo "VERSION=${VERSION}" >> $GITHUB_ENV
3132
echo "VERSION=${VERSION}"
3233
34+
- name: Set image tags
35+
id: set-tags
36+
run: |
37+
TAGS="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}"
38+
39+
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
40+
TAGS="$TAGS,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
41+
fi
42+
43+
if [[ "${{ github.ref }}" == "refs/heads/release-*" ]]; then
44+
RELEASE_BRANCH_NAME=$(basename "${{ github.ref }}")
45+
TAGS="$TAGS,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${RELEASE_BRANCH_NAME}"
46+
fi
47+
48+
echo "tags=$TAGS" >> $GITHUB_OUTPUT
49+
50+
- name: Set up QEMU
51+
uses: docker/setup-qemu-action@v3
52+
53+
- name: Set up Docker Buildx
54+
uses: docker/setup-buildx-action@v3
55+
3356
- name: Log in to the Container registry
3457
uses: docker/login-action@v3
3558
with:
@@ -38,8 +61,15 @@ jobs:
3861
password: ${{ secrets.QUAY_TOKEN }}
3962

4063
- name: Build and push Docker image
41-
run: |
42-
make docker-buildx IMG=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
64+
id: push
65+
uses: docker/build-push-action@v6
66+
with:
67+
context: .
68+
push: true
69+
tags: ${{ steps.set-tags.outputs.tags }}
70+
platforms: linux/amd64,linux/arm64
71+
cache-from: type=gha
72+
cache-to: type=gha,mode=max
4373

4474
publish-helm-charts-containers:
4575
needs: build-and-push-image
@@ -73,3 +103,9 @@ jobs:
73103
- name: Push helm charts
74104
run: |
75105
helm push jumpstarter-*.tgz oci://${{ env.QUAY_ORG }}/helm
106+
107+
if [[ "${{ github.ref }}" == "refs/heads/release-*" ]]; then
108+
RELEASE_BRANCH_NAME=$(basename "${{ github.ref }}")
109+
helm chart save jumpstarter-*.tgz ${{ env.QUAY_ORG }}/helm:${RELEASE_BRANCH_NAME}
110+
helm chart push ${{ env.QUAY_ORG }}/helm:${RELEASE_BRANCH_NAME}
111+
fi

0 commit comments

Comments
 (0)