Skip to content

Commit bff1b94

Browse files
authored
Merge pull request #14 from faroshq/grab.a.bag.part2
Clean CI names
2 parents c63997b + d0b9f6a commit bff1b94

4 files changed

Lines changed: 141 additions & 157 deletions

File tree

.github/workflows/goreleaser.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: goreleaser
1+
name: GoReleaser
22

33
on:
44
pull_request:

.github/workflows/helm-images.yaml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Helm OCI Image Build and Push
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- "v*"
9+
10+
permissions:
11+
contents: read
12+
packages: write
13+
id-token: write
14+
15+
jobs:
16+
build-hub:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v3
23+
24+
- name: Login to GitHub Container Registry
25+
uses: docker/login-action@v3
26+
with:
27+
registry: ghcr.io
28+
username: ${{ github.actor }}
29+
password: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: Install Helm
32+
uses: azure/setup-helm@v3
33+
with:
34+
version: 'v3.12.0'
35+
36+
- name: Extract metadata
37+
id: meta
38+
uses: docker/metadata-action@v5
39+
with:
40+
images: ghcr.io/faroshq/kedge-hub
41+
tags: |
42+
type=semver,pattern={{version}}
43+
type=semver,pattern={{major}}.{{minor}}
44+
type=sha
45+
46+
- name: Package and push Helm charts as OCI
47+
env:
48+
HELM_EXPERIMENTAL_OCI: 1
49+
run: |
50+
# Login to GitHub Container Registry for Helm
51+
echo "${{ github.token }}" | helm registry login ghcr.io --username ${{ github.actor }} --password-stdin
52+
53+
# Set chart version - use tag name if available, otherwise use semver format
54+
if [[ "${{ github.ref_type }}" == "tag" ]]; then
55+
CHART_VERSION="${{ github.ref_name }}"
56+
# Remove 'v' prefix if present
57+
CHART_VERSION="${CHART_VERSION#v}"
58+
else
59+
CHART_VERSION="0.0.0-${{ github.sha }}"
60+
fi
61+
62+
# Package and push each chart in deploy/charts/
63+
for chart_dir in deploy/charts/*/; do
64+
if [ -f "${chart_dir}Chart.yaml" ]; then
65+
chart_name=$(basename "$chart_dir")
66+
echo "Processing chart: $chart_name"
67+
68+
# Update chart version and appVersion in Chart.yaml
69+
sed -i "s/^version:.*/version: ${CHART_VERSION}/" "${chart_dir}Chart.yaml"
70+
sed -i "s/^appVersion:.*/appVersion: ${CHART_VERSION}/" "${chart_dir}Chart.yaml"
71+
72+
# Package the chart
73+
helm package "$chart_dir" --version "${CHART_VERSION}"
74+
75+
# Push to GitHub Container Registry
76+
helm push "${chart_name}-${CHART_VERSION}.tgz" "oci://ghcr.io/${{ github.repository_owner }}/charts"
77+
78+
echo "Helm chart pushed to oci://ghcr.io/${{ github.repository_owner }}/charts/${chart_name}:${CHART_VERSION}"
79+
fi
80+
done

.github/workflows/images.yaml

Lines changed: 60 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,94 @@
1-
name: Build and Push Images
1+
name: Container Image Build and Push
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
tags:
8-
- "v*"
4+
release:
5+
types: [created]
96

107
permissions:
118
contents: read
129
packages: write
1310
id-token: write
1411

12+
env:
13+
REGISTRY: ghcr.io
14+
HUB_IMAGE_NAME: ${{ github.repository }}
15+
AGENT_IMAGE_NAME: ${{ github.repository }}-agent
16+
1517
jobs:
16-
build-hub:
18+
build-and-push-hub-image:
1719
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
packages: write
1823
steps:
19-
- uses: actions/checkout@v4
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
27+
- name: Log in to the Container registry
28+
uses: docker/login-action@v3
29+
with:
30+
registry: ${{ env.REGISTRY }}
31+
username: ${{ github.actor }}
32+
password: ${{ secrets.GITHUB_TOKEN }}
2033

2134
- name: Set up Docker Buildx
2235
uses: docker/setup-buildx-action@v3
2336

24-
- name: Login to GitHub Container Registry
37+
- name: Extract metadata (tags, labels) for Docker
38+
id: meta
39+
uses: docker/metadata-action@v5
40+
with:
41+
images: ${{ env.REGISTRY }}/${{ env.HUB_IMAGE_NAME }}
42+
43+
- name: Build and push Docker image
44+
uses: docker/build-push-action@v6
45+
with:
46+
context: .
47+
file: ./deploy/Dockerfile.hub
48+
platforms: linux/amd64,linux/arm64
49+
push: true
50+
tags: ${{ steps.meta.outputs.tags }}
51+
labels: ${{ steps.meta.outputs.labels }}
52+
build-args: |
53+
VERSION=${{ github.ref_name }}
54+
GIT_COMMIT=${{ github.sha }}
55+
BUILD_DATE=${{ github.event.release.created_at }}
56+
57+
build-and-push-agent-image:
58+
runs-on: ubuntu-latest
59+
permissions:
60+
contents: read
61+
packages: write
62+
steps:
63+
- name: Checkout repository
64+
uses: actions/checkout@v4
65+
66+
- name: Log in to the Container registry
2567
uses: docker/login-action@v3
2668
with:
27-
registry: ghcr.io
69+
registry: ${{ env.REGISTRY }}
2870
username: ${{ github.actor }}
2971
password: ${{ secrets.GITHUB_TOKEN }}
3072

31-
- name: Install Helm
32-
uses: azure/setup-helm@v3
33-
with:
34-
version: 'v3.12.0'
73+
- name: Set up Docker Buildx
74+
uses: docker/setup-buildx-action@v3
3575

36-
- name: Extract metadata
76+
- name: Extract metadata (tags, labels) for Docker
3777
id: meta
3878
uses: docker/metadata-action@v5
3979
with:
40-
images: ghcr.io/faroshq/kedge-hub
41-
tags: |
42-
type=semver,pattern={{version}}
43-
type=semver,pattern={{major}}.{{minor}}
44-
type=sha
80+
images: ${{ env.REGISTRY }}/${{ env.AGENT_IMAGE_NAME }}
4581

46-
- name: Build and push
82+
- name: Build and push Docker image
4783
uses: docker/build-push-action@v6
4884
with:
4985
context: .
50-
file: deploy/Dockerfile.hub
86+
file: ./deploy/Dockerfile.agent
87+
platforms: linux/amd64,linux/arm64
5188
push: true
5289
tags: ${{ steps.meta.outputs.tags }}
5390
labels: ${{ steps.meta.outputs.labels }}
5491
build-args: |
5592
VERSION=${{ github.ref_name }}
5693
GIT_COMMIT=${{ github.sha }}
57-
BUILD_DATE=${{ github.event.head_commit.timestamp }}
58-
cache-from: type=gha
59-
cache-to: type=gha,mode=max
60-
platforms: linux/amd64,linux/arm64
61-
62-
- name: Package and push Helm charts as OCI
63-
env:
64-
HELM_EXPERIMENTAL_OCI: 1
65-
run: |
66-
# Login to GitHub Container Registry for Helm
67-
echo "${{ github.token }}" | helm registry login ghcr.io --username ${{ github.actor }} --password-stdin
68-
69-
# Set chart version - use tag name if available, otherwise use semver format
70-
if [[ "${{ github.ref_type }}" == "tag" ]]; then
71-
CHART_VERSION="${{ github.ref_name }}"
72-
# Remove 'v' prefix if present
73-
CHART_VERSION="${CHART_VERSION#v}"
74-
else
75-
CHART_VERSION="0.0.0-${{ github.sha }}"
76-
fi
77-
78-
# Package and push each chart in deploy/charts/
79-
for chart_dir in deploy/charts/*/; do
80-
if [ -f "${chart_dir}Chart.yaml" ]; then
81-
chart_name=$(basename "$chart_dir")
82-
echo "Processing chart: $chart_name"
83-
84-
# Update chart version and appVersion in Chart.yaml
85-
sed -i "s/^version:.*/version: ${CHART_VERSION}/" "${chart_dir}Chart.yaml"
86-
sed -i "s/^appVersion:.*/appVersion: ${CHART_VERSION}/" "${chart_dir}Chart.yaml"
87-
88-
# Package the chart
89-
helm package "$chart_dir" --version "${CHART_VERSION}"
90-
91-
# Push to GitHub Container Registry
92-
helm push "${chart_name}-${CHART_VERSION}.tgz" "oci://ghcr.io/${{ github.repository_owner }}/charts"
93-
94-
echo "Helm chart pushed to oci://ghcr.io/${{ github.repository_owner }}/charts/${chart_name}:${CHART_VERSION}"
95-
fi
96-
done
94+
BUILD_DATE=${{ github.event.release.created_at }}

.github/workflows/publish.yaml

Lines changed: 0 additions & 94 deletions
This file was deleted.

0 commit comments

Comments
 (0)