-
Notifications
You must be signed in to change notification settings - Fork 1
94 lines (78 loc) · 2.83 KB
/
Copy pathrelease.yml
File metadata and controls
94 lines (78 loc) · 2.83 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
name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+'
concurrency:
group: kai-release-${{ github.ref }}
cancel-in-progress: false
jobs:
chart:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Helm
uses: azure/setup-helm@v4
- name: Compute metadata
id: meta
run: |
FULL_TAG="${GITHUB_REF#refs/tags/}" # v1.0.0
VERSION="${GITHUB_REF#refs/tags/v}" # 1.0.0
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "full_tag=${FULL_TAG}" >> "$GITHUB_OUTPUT"
echo "chart_version=${VERSION}-chart" >> "$GITHUB_OUTPUT"
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_TOKEN }}
password: ${{ secrets.DOCKERHUB_PASSWD }}
- name: Package and push chart
run: |
VERSION="${{ steps.meta.outputs.version }}"
FULL_TAG="${{ steps.meta.outputs.full_tag }}"
CHART_VERSION="${{ steps.meta.outputs.chart_version }}"
CHART_DIR="chart/kai-resource-isolator"
sed -i "s/^version:.*/version: ${CHART_VERSION}/" "${CHART_DIR}/Chart.yaml"
sed -i "s/^appVersion:.*/appVersion: \"${VERSION}\"/" "${CHART_DIR}/Chart.yaml"
sed -i "s/^ tag:.*/ tag: ${FULL_TAG}/" "${CHART_DIR}/values.yaml"
helm package "${CHART_DIR}" --version "${CHART_VERSION}"
# Push to oci://docker.io/projecthami; helm appends the chart name
# resulting in docker.io/projecthami/kai-resource-isolator:<chart_version>
helm push "kai-resource-isolator-${CHART_VERSION}.tgz" oci://docker.io/projecthami
docker:
needs: chart
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Compute metadata
id: meta
run: |
FULL_TAG="${GITHUB_REF#refs/tags/}" # v1.0.0
REPO="docker.io/projecthami/kai-resource-isolator"
echo "tags=${REPO}:${FULL_TAG},${REPO}:latest" >> "$GITHUB_OUTPUT"
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_TOKEN }}
password: ${{ secrets.DOCKERHUB_PASSWD }}
- name: Build and push image
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}