-
Notifications
You must be signed in to change notification settings - Fork 8
149 lines (133 loc) · 5.16 KB
/
push-dev.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: push-dev
on:
push:
branches:
- dev
paths-ignore:
- '.github/**'
jobs:
push-dev:
runs-on: ubuntu-latest
permissions:
contents: write
pages: write
steps:
- name: Checkout Code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
ref: ${{ github.event.pull_request.head.ref }} # checkout the correct branch name
fetch-depth: 0 # fetch the whole repo history
- name: Git Version
id: auto_version
uses: codacy/[email protected]
with:
prefix: v
minor-identifier: /feat(ure)*:/
major-identifier: /breaking:/
- name: Set package version
id: version
run: |
if [[ $INPUT_VERSION ]]; then
echo "version=$INPUT_VERSION" >> $GITHUB_OUTPUT
else
echo "version=${{ steps.auto_version.outputs.version }}" >> $GITHUB_OUTPUT
fi
# DOCKER BUILD & PUSH
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Quay.io
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: quay.io
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
push: true
pull: true
tags: '${{ secrets.DOCKER_REGISTRY_NAME }}/csi-wekafs:${{ steps.auto_version.outputs.version }}'
cache-from: type=gha
cache-to: type=gha,mode=max
labels: |
revision=${{ steps.auto_version.outputs.version }}
quay.expires-after=14d
provenance: false # https://issues.redhat.com/browse/PROJQUAY-5013 quay doesn't support it
build-args: |
VERSION='${{ steps.auto_version.outputs.version }}'
# HELM
- name: Get Helm chart version
id: helm_version
run: |
out="$(echo "${{ steps.auto_version.outputs.version }}" | sed 's/^v//1')"
echo "helm_version=$out" >> $GITHUB_OUTPUT
- name: Update Helm chart version
uses: mikefarah/yq@master
with:
cmd: |
BASEDIR=charts/csi-wekafsplugin
DRIVER_VERSION="$(echo ${{ steps.version.outputs.version }} | sed 's/^v//1')"
CHART_VERSION="${{ steps.helm_version.outputs.helm_version }}"
APP_VERSION="${{ steps.version.outputs.version }}"
yq -i '.version = "'$CHART_VERSION'"' $BASEDIR/Chart.yaml
yq -i '.appVersion = "'$APP_VERSION'"' $BASEDIR/Chart.yaml
yq -i '.sources[0] = "https://github.com/weka/csi-wekafs/tree/v$CHART_VERSION/charts/csi-wekafsplugin"' $BASEDIR/Chart.yaml
yq -i '.csiDriverVersion = "'$DRIVER_VERSION'"' $BASEDIR/values.yaml
echo ------------------ values ------------------
cat $BASEDIR/values.yaml
echo --------------------chart ------------------
cat $BASEDIR/Chart.yaml
- name: helm-docs
uses: addnab/docker-run-action@v3
with:
image: jnorwood/helm-docs:latest
options: -v ${{ github.workspace }}:/data
run: |
cd /data
helm-docs -s file -c charts -o ../../README.md -t ../README.md.gotmpl
helm-docs -s file -c charts
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: v3.10.0
- name: update Helm schema
run: |
helm plugin install https://github.com/karuppiah7890/helm-schema-gen.git
helm schema-gen charts/csi-wekafsplugin/values.yaml >| charts/csi-wekafsplugin/values.schema.json
- uses: actions/setup-python@v5
with:
python-version: '3.9'
check-latest: true
# TEST CHART
- name: Set up chart-testing
uses: helm/[email protected]
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --chart-dirs charts --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Run chart-testing (lint)
run: ct lint --chart-dirs charts --all --debug --validate-maintainers=false --target-branch ${{ github.event.repository.default_branch }}
- name: Create kind cluster
uses: helm/[email protected]
if: steps.list-changed.outputs.changed == 'true'
- name: Run chart-testing (install)
id: helm-test
run: |
ct install --print-config --chart-dirs charts --all --debug --helm-extra-args "--timeout 60s" && \
echo "passed=true" >> $GITHUB_OUTPUT
if: steps.list-changed.outputs.changed == 'true'
# PUSH CHANGES BACK TO BRANCH
- name: Commit & Push changes
uses: actions-js/push@master
with:
author_name: Weka CSI Bot
author_email: [email protected]
github_token: ${{ secrets.BOTTY_GH_TOKEN }}
branch: dev
if: |
steps.helm-test.outputs.passed == 'true'