-
Notifications
You must be signed in to change notification settings - Fork 2
134 lines (126 loc) · 4.23 KB
/
main.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
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
130
131
132
133
134
---
name: "Main"
"on":
push:
pull_request:
jobs:
pre-commit-job:
runs-on: "ubuntu-22.04"
steps:
- name: "Checkout repository"
uses: "actions/[email protected]"
- name: "Set up python and pip cache"
uses: "actions/[email protected]"
with:
python-version: "3.11.4"
cache: "pip"
- name: "Install python dependencies"
run: "pip install -r requirements.txt"
- name: "Set up pre-commit cache"
uses: "actions/[email protected]"
with:
path: "~/.cache/pre-commit"
key: "pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}"
- name: "Run pre-commit"
run: "pre-commit run --all-files --color=always --show-diff-on-failure"
helm-lint-job:
runs-on: "ubuntu-22.04"
container:
image: "alpine/helm:3.15.2"
steps:
- name: "Checkout repository"
uses: "actions/[email protected]"
- name: "Run 'helm lint'"
run: "helm lint ./charts/grafaml"
kube-linter-lint-job:
runs-on: "ubuntu-22.04"
steps:
- name: "Checkout repository"
uses: "actions/[email protected]"
- name: "Run 'kube-linter'"
uses: "stackrox/[email protected]"
with:
directory: "./charts/grafaml"
helm-test-job:
runs-on: "ubuntu-22.04"
container:
image: "alpine/helm:3.15.2"
steps:
- name: "Checkout repository"
uses: "actions/[email protected]"
- name: "Install 'Helm Unittest'"
run: "helm plugin install https://github.com/helm-unittest/helm-unittest.git"
- name: "Run 'helm unittest'"
run: "helm unittest ./charts/grafaml"
determine-version-job:
runs-on: "ubuntu-22.04"
permissions:
contents: "write"
issues: "write"
pull-requests: "write"
outputs:
version: "${{ steps.determineVersion.outputs.version }}"
steps:
- name: "Checkout repository"
uses: "actions/[email protected]"
- name: "Set up node and yarn"
uses: "actions/[email protected]"
with:
node-version: "20.11.0"
- name: "Install semantic-release"
run: "yarn add semantic-release"
- name: "Determine version"
id: "determineVersion"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: >-
echo version="$(npx semantic-release --dry-run |
grep -Po '(?<=t|The next release version is )\d+\.\d+\.\d+(?:-[a-zA-Z0-9.]+)?')"
>> "$GITHUB_OUTPUT"
- name: "Echo new version"
run: "echo \"The new version is ${{ steps.determineVersion.outputs.version }}\""
helm-push-job:
needs:
- "pre-commit-job"
- "helm-lint-job"
- "kube-linter-lint-job"
- "helm-test-job"
- "determine-version-job"
if: "needs.determine-version-job.outputs.version != ''"
runs-on: "ubuntu-22.04"
container:
image: "alpine/helm:3.15.2"
steps:
- name: "Checkout repository"
uses: "actions/[email protected]"
- name: "Echo new version"
run: "echo \"The package will be released with version ${{ needs.determine-version-job.outputs.version }}\""
- name: "Run 'helm package'"
run: "helm package ./charts/grafaml --version ${{ needs.determine-version-job.outputs.version }}"
- name: "Run 'helm registry login'"
run: "helm registry login registry-1.docker.io --username ernail --password ${{ secrets.DOCKER_REGISTRY_TOKEN }}"
- name: "Run 'helm push'"
run: "helm push grafaml-${{ needs.determine-version-job.outputs.version }}.tgz oci://registry-1.docker.io/ernail"
semantic-release-job:
needs:
- "helm-push-job"
runs-on: "ubuntu-22.04"
permissions:
contents: "write"
issues: "write"
pull-requests: "write"
steps:
- name: "Checkout repository"
uses: "actions/[email protected]"
with:
persist-credentials: false
- name: "Set up node and yarn"
uses: "actions/[email protected]"
with:
node-version: "20.11.0"
- name: "Install semantic-release"
run: "yarn add semantic-release"
- name: "Run semantic-release"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: "npx semantic-release"