-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (109 loc) · 3.95 KB
/
ci.yml
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Workflow
on:
push:
branches:
- main
jobs:
Job:
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.8]
helm-version: [v3.4.0]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Configure Git
run: |
git config user.name "${GITHUB_REPOSITORY_OWNER}"
git config user.email "${GITHUB_REPOSITORY_OWNER}@users.noreply.github.com"
- name: Fetch History
run: git fetch --prune --unshallow
- uses: FranzDiebold/github-env-vars-action@v2
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Helm
uses: azure/setup-helm@v1
with:
version: ${{ matrix.helm-version }}
- name: Add Bitnami Repo
run: helm repo add bitnami https://charts.bitnami.com/bitnami
- name: Set up chart-testing
uses: helm/[email protected]
- name: Run chart-testing (lint)
run: ct lint --chart-dirs chart --target-branch main --all
- name: Install chart-releaser
run: |
sudo curl -sLo /tmp/cr \
https://github.com/helm/chart-releaser/releases/download/v1.6.1/chart-releaser_1.6.1_linux_amd64.tar.gz
sudo tar xvf /tmp/cr cr
sudo chmod +x /tmp/cr
mv cr /usr/local/bin/cr
cr version
- name: Install yq
run: |
sudo curl -sLo /usr/local/bin/yq \
https://github.com/mikefarah/yq/releases/download/v4.3.2/yq_linux_amd64 && \
sudo chmod +x /usr/local/bin/yq
yq -V
- name: Conventional Changelog Action
id: changelog
uses: TriPSs/conventional-changelog-action@v3
with:
github-token: ${{ secrets.github_token }}
pre-commit: preCommit.js
version-file: ./chart/lambda/Chart.yaml
version-path: version
release-count: 0
git-user-name: ${{ github.repository_owner }}
git-user-email: "${{ github.repository_owner }}@users.noreply.github.com"
- name: Create Package
run: cr package chart/lambda/ --package-path ./
- name: Release
if: ${{ steps.changelog.outputs.tag }}
env:
TAG: ${{ steps.changelog.outputs.tag }}
MSG: ${{ steps.changelog.outputs.clean_changelog }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
sudo apt-get update && sudo apt-get install -yq hub
set -x
assets=()
for asset in lambda-*.tgz; do
assets+=("-a" "$asset")
done
echo -e "$TAG\n\n$MSG" | hub release create "${assets[@]}" -F- "$TAG"
- name: Update Index.yaml
run: |
cr index \
--owner "${GITHUB_REPOSITORY_OWNER}" \
--git-repo "${CI_REPOSITORY_NAME}" \
--token "${GITHUB_TOKEN}" \
--release-name-template "v{{ .Version }}" \
--push \
--package-path ./ \
-i index.yaml
if: ${{ steps.changelog.outputs.tag }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
if: ${{ steps.changelog.outputs.tag }}
- name: Log into GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR }}
if: ${{ steps.changelog.outputs.tag }}
- name: Build and Push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: |
ghcr.io/${{ env.CI_REPOSITORY_OWNER_SLUG }}/${{ env.CI_REPOSITORY_NAME_SLUG }}:${{ steps.changelog.outputs.tag }}
ghcr.io/${{ env.CI_REPOSITORY_OWNER_SLUG }}/${{ env.CI_REPOSITORY_NAME_SLUG }}:latest
if: ${{ steps.changelog.outputs.tag }}