Skip to content

Commit

Permalink
Use action
Browse files Browse the repository at this point in the history
  • Loading branch information
trinhpham committed Oct 12, 2024
1 parent 41986a2 commit 2bdaa86
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
29 changes: 16 additions & 13 deletions .github/workflows/weekly-scanner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ jobs:
matrix-setup:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.value }}
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- id: matrix
run: |
echo "value=$(jq -c < repositories.json | jq -R | sed -e 's/^"//' -e 's/"$//')" >> $GITHUB_OUTPUT
- run: |
echo "${{ steps.matrix.outputs.value }}"
- name: Checkout
uses: actions/checkout@v3

- name: Get Matrix
id: matrix
uses: Surnet/get-json-matrix@v1
with:
filepath: ./repositories.json

check-and-publish-helm-charts:
needs: ["matrix-setup"]
needs: matrix-setup
runs-on: ubuntu-latest
strategy:
matrix:
value: ${{fromJSON(needs.matrix-setup.outputs.matrix)}}
matrix: ${{ fromJson(needs.matrix-setup.outputs.matrix) }}
steps:
- name: Set up Helm
uses: azure/setup-helm@v4
Expand All @@ -37,15 +37,18 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Read repositories list and loop
env:
REPO_INFO: ${{ toJSON(matrix.value) }} # path to repositories, chart_paths, and tag_regex
run: |
REPO_INFO=${{ matrix.value }} # path to repositories, chart_paths, and tag_regex
set -x
set +e
OCI_REGISTRY='oci://registry-1.docker.io/ez4devcharts' # modify this if your registry differs
# Ensure jq is installed
sudo apt-get update && sudo apt-get install -y jq
# Parse repo info
REPO_NAME=$(echo $REPO_INFO | jq -r '.repository')
REPO_NAME=${{ matrix.key }}
CHART_PATH=$(echo $REPO_INFO | jq -r '.chart_path')
CHART_NAME=$(echo $REPO_INFO | jq -r '.chart_name')
TAG_REGEX=$(echo $REPO_INFO | jq -r '.tag_regex')
Expand Down
7 changes: 3 additions & 4 deletions repositories.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[
{
"repository": "syseleven/designate-certmanager-webhook",
{
"syseleven/designate-certmanager-webhook": {
"chart_path": "helm/designate-certmanager-webhook",
"chart_name": "designate-certmanager-webhook",
"tag_regex": "helm-\\K[0-9]+\\.[0-9]+\\.[0-9]+"
}
]
}

0 comments on commit 2bdaa86

Please sign in to comment.