Detecting changes in VERSION files #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TODO: Release a docker image for each service that has a changed VERSION file | |
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 | |
if: needs.print-changed-services.outputs.services != '[]' | |
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 }}" |