Skip to content

Commit da2fa49

Browse files
authored
Merge pull request #289 from osamamagdy/add-helm-releaser
Add helm releaser
2 parents e605495 + 25158c6 commit da2fa49

File tree

7 files changed

+271
-92
lines changed

7 files changed

+271
-92
lines changed

.github/workflows/pre-commit.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ env:
1010
TF_DOCS_VERSION: v0.16.0
1111
TFLINT_VERSION: v0.44.1
1212
TF_VERSION: "1.3.4"
13+
HELM_DOCS_VERSION: "1.7.0"
1314
permissions:
1415
contents: read
1516
jobs:
@@ -42,6 +43,12 @@ jobs:
4243
tar -zxvf terraform_docs.tar.gz terraform-docs
4344
chmod +x terraform-docs
4445
mv terraform-docs /usr/local/bin/
46+
- name: Setup helm-docs
47+
run: |
48+
cd /tmp
49+
wget https://github.com/norwoodj/helm-docs/releases/download/v${{env.HELM_DOCS_VERSION}}/helm-docs_${{env.HELM_DOCS_VERSION}}_Linux_x86_64.tar.gz
50+
tar -xvf helm-docs_${{env.HELM_DOCS_VERSION}}_Linux_x86_64.tar.gz
51+
sudo mv helm-docs /usr/local/sbin
4552
- name: Pre-commit checks
4653
uses: pre-commit/[email protected]
4754
- name: pre-commit-ci-lite

.github/workflows/publish.yml

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- uses: actions/checkout@v3
11+
- name: Configure Git
12+
run: |
13+
git config user.name "$GITHUB_ACTOR"
14+
git config user.email "[email protected]"
1115
- name: "Install yq"
1216
run: |
1317
sudo snap install yq
@@ -19,11 +23,44 @@ jobs:
1923
RELEASE_VERSION="${RELEASE_VERSION//v}"
2024
# patch the version & appVersion in the Chart.yaml to the release version
2125
yq eval -i ".version = \"$RELEASE_VERSION\", .appVersion = \"$RELEASE_VERSION\"" Chart.yaml
22-
- uses: J12934/[email protected]
26+
- name: install helm-docs
27+
env:
28+
HELM_DOCS_VERSION: "1.7.0"
29+
run: |
30+
cd /tmp
31+
wget https://github.com/norwoodj/helm-docs/releases/download/v${{env.HELM_DOCS_VERSION}}/helm-docs_${{env.HELM_DOCS_VERSION}}_Linux_x86_64.tar.gz
32+
tar -xvf helm-docs_${{env.HELM_DOCS_VERSION}}_Linux_x86_64.tar.gz
33+
sudo mv helm-docs /usr/local/sbin
34+
- name: Generate and Release Helm Docs
35+
run: |
36+
helm-docs -t helm/wrongsecrets-ctf-party/README.md.gotmpl -t helm/wrongsecrets-ctf-party/_template.gotmpl -o README.md
37+
cp helm/wrongsecrets-ctf-party/README.md /tmp/README.md
38+
- name: Update gh-pages branch
39+
uses: actions/checkout@v3
40+
with:
41+
ref: gh-pages
42+
fetch-depth: 0
43+
- name: Copy README.md to gh-pages
44+
run: |
45+
cp /tmp/README.md README.md
46+
- name: Commit and push changes (if any)
47+
run: |
48+
if git diff --exit-code; then
49+
echo "No changes detected."
50+
else
51+
echo "Changes detected."
52+
git add README.md
53+
git commit -m "Update README.md"
54+
git push
55+
fi
56+
- name: Get back to original branch
57+
uses: actions/checkout@v3
58+
- name: Run chart-releaser
59+
uses: helm/[email protected]
2360
with:
24-
access-token: ${{ secrets.ACCESS_TOKEN }}
25-
charts-folder: helm
26-
deploy-branch: gh-pages
61+
charts_dir: helm
62+
env:
63+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
2764
dockerBuilds:
2865
name: "Build"
2966
runs-on: ubuntu-latest

.pre-commit-config.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,20 @@ repos:
3131
- "--args=--only=terraform_standard_module_structure"
3232
- "--args=--only=terraform_workspace_remote"
3333
- id: terraform_docs
34+
- repo: https://github.com/norwoodj/helm-docs
35+
rev: v1.2.0
36+
hooks:
37+
- id: helm-docs
38+
args:
39+
# Make the tool search for charts only under the `example-charts` directory
40+
- --chart-search-root=helm
41+
42+
# The `./` makes it relative to the chart-search-root set above
43+
- --template-files=./_templates.gotmpl
44+
45+
# Repeating the flag adds this to the list, now [./_templates.gotmpl, README.md.gotmpl]
46+
# A base filename makes it relative to each chart directory found
47+
- --template-files=README.md.gotmpl
3448
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
3549
rev: v9.4.0
3650
hooks:

helm/wrongsecrets-ctf-party/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: wrongsecrets-ctf-party
33
description: Run Multi User "Capture the Flags" or Security Trainings with OWASP Wrongsecrets
44
icon: https://github.com/OWASP/wrongsecrets/blob/master/icon.png?raw=true
55

6-
home: https://github.com/
6+
home: https://owasp.org/www-project-wrongsecrets/
77
sources:
88
- https://github.com/OWASP/wrongsecrets-ctf-party
99

0 commit comments

Comments
 (0)