Skip to content

Detecting changes in VERSION files #9

Detecting changes in VERSION files

Detecting changes in VERSION files #9

Workflow file for this run

name: test-detecting-version-changes
run-name: Detecting changes in VERSION files
on:
push:
branches:
- main
paths:
- '*/VERSION'
jobs:
print-changed-services:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Store services with changed VERSION files
id: changed-services
run: |
echo "services=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep '/VERSION$' | grep -v 'TEMPLATE' | cut -d '/' -f 1 | uniq | jq -R -s -c 'split("\n")[:-1]')" >> "$GITHUB_OUTPUT"
- name: Print services with changed VERSION files
run: |
echo "Services with changed VERSION files: ${{ steps.changed-services.outputs.services }}"
outputs:
services: ${{ steps.changed-services.outputs.services }}
for-each-changed:
needs: print-changed-services
runs-on: ubuntu-latest
strategy:
matrix:
service: ${{ fromJson(needs.print-changed-services.outputs.services) }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Enter service directory
run: cd ${{ matrix.service }}
- name: Print changed files
run: |
echo "Changed files: $(git diff --name-only ${{ github.event.before }} ${{ github.event.after }})"
- name: Print service
run: |
echo "Service: ${{ matrix.service }}"