Skip to content

Commit

Permalink
Updating artifact-update workflow to run only when the file changes (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dunefro authored Nov 1, 2024
1 parent 494406e commit de2dfa5
Showing 1 changed file with 31 additions and 10 deletions.
41 changes: 31 additions & 10 deletions .github/workflows/update-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,37 @@ on:
pull_request:
branches:
- 'main'
paths:
- '.github/workflows/update-artifacts.yml'
- 'charts/tfy-k8s-aws-eks-inframold/**'
- 'charts/tfy-k8s-azure-aks-inframold/**'
- 'charts/tfy-k8s-civo-talos-inframold/**'
- 'charts/tfy-k8s-gcp-gke-standard-inframold/**'
- 'charts/tfy-k8s-generic-inframold/**'
- 'scripts/generate-artifacts-manifest/**'
- 'scripts/upload-artifacts/**'



jobs:
path-filter:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Check if the following files changed
uses: dorny/paths-filter@v3
id: path_filtering
with:
filters: |
pathsrc:
- '.github/workflows/update-artifacts.yml'
- 'charts/tfy-k8s-aws-eks-inframold/**'
- 'charts/tfy-k8s-azure-aks-inframold/**'
- 'charts/tfy-k8s-civo-talos-inframold/**'
- 'charts/tfy-k8s-gcp-gke-standard-inframold/**'
- 'charts/tfy-k8s-generic-inframold/**'
- 'scripts/generate-artifacts-manifest/**'
- 'scripts/upload-artifacts/**'
outputs:
pathsrc_output: ${{ steps.path_filtering.outputs.pathsrc}} == 'true'

update-artifacts:
runs-on: ubuntu-latest
needs: path-filter
permissions:
contents: write
env:
Expand All @@ -26,7 +44,7 @@ jobs:
ARTIFACTORY_HELM_REGISTRY_URL: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_PUBLIC_HELM_REGISTRY }}
steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
Expand All @@ -47,12 +65,14 @@ jobs:
python-version: '3.10'

- name: Install python dependencies
if: needs.path-filter.outputs.pathsrc_output == 'true'
run: |
pip install -r scripts/upload-artifacts/requirements.txt
pip install -r scripts/generate-artifacts-manifest/requirements.txt
# Generate artifacts manifest for inframold charts
- name: Generate Artifacts Manifest for Each Chart
if: needs.path-filter.outputs.pathsrc_output == 'true'
run: |
charts_list=("tfy-k8s-aws-eks-inframold" "tfy-k8s-azure-aks-inframold" "tfy-k8s-gcp-gke-standard-inframold" "tfy-k8s-generic-inframold")
for chart in "${charts_list[@]}";
Expand All @@ -66,6 +86,7 @@ jobs:

# Update the inframold artifacts manifest
- name: Update Artifacts Manifest
if: needs.path-filter.outputs.pathsrc_output == 'true'
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
Expand Down

0 comments on commit de2dfa5

Please sign in to comment.