-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (80 loc) · 2.77 KB
/
release.yaml
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
name: Release
on:
push:
tags:
- 'csa-*'
jobs:
validate-tag:
name: Validate tag
runs-on: ubuntu-latest
steps:
- name: Validate tag
run: |
if ! [[ "$GITHUB_REF_NAME" =~ ^csa-[0-9]+.[0-9]+.[0-9]+$ ]]; then
echo "Tag does not match expected pattern - got $GITHUB_REF_NAME"
exit 1
fi
publish-docker-image:
name: Publish Docker image
runs-on: ubuntu-latest
needs: validate-tag
steps:
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: expediagroup/container-startup-autoscaler
tags: |
type=match,pattern=csa-(.*),group=1
- name: Docker setup QEMU
uses: docker/setup-qemu-action@v3
- name: Docker setup buildx
uses: docker/setup-buildx-action@v3
- name: Docker Hub login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Docker build and push
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
publish-helm-chart:
name: Publish Helm chart
runs-on: ubuntu-latest
needs: publish-docker-image
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Helm
uses: azure/setup-helm@v3
with:
version: v3.13.1
- name: Install chart-releaser
uses: helm/[email protected]
with:
install_only: true
- name: Run chart-releaser
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
CR_RELEASE_NAME_TEMPLATE: "chart-{{ .Version }}"
run: |
owner=$(cut -d '/' -f 1 <<< "$GITHUB_REPOSITORY")
repo=$(cut -d '/' -f 2 <<< "$GITHUB_REPOSITORY")
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
rm -rf .cr-release-packages
rm -rf .cr-index
mkdir -p .cr-release-packages
mkdir -p .cr-index
cr package charts/container-startup-autoscaler
# https://github.com/helm/chart-releaser#create-github-releases-from-helm-chart-packages
cr upload -o "$owner" -r "$repo" -c "$(git rev-parse HEAD)" --skip-existing \
--release-notes-file=releasenotes.md --make-release-latest=false
# https://github.com/helm/chart-releaser#create-the-repository-index-from-github-releases
cr index -o "$owner" -r "$repo" --push