Fixes intake_es catalog #30
Workflow file for this run
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
name: Containers | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'dockerfiles/**' | |
pull_request: | |
branches: | |
- main | |
paths: | |
- 'dockerfiles/**' | |
jobs: | |
detect-changes: | |
runs-on: ubuntu-latest | |
name: Detect changes to Dockerfiles | |
outputs: | |
directories: ${{ steps.list-changed-files.outputs.output }} | |
changed: ${{ steps.list-changed-files.outputs.changed }} | |
permissions: | |
pull-requests: read | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v37 | |
with: | |
json: true | |
dir_names: true | |
dir_names_max_depth: 2 | |
files: dockerfiles/** | |
files_ignore: dockerfiles/template | |
- name: List all changed files | |
id: list-changed-files | |
run: | | |
changed_files="${{ steps.changed-files.outputs.all_changed_files }}" | |
containers="$(echo ${changed_files} | python -c 'import sys, json; print(json.dumps([x.split("/")[1] for x in json.loads(sys.stdin.read()) if "/" in x]))')" | |
changed="$(echo ${containers} | python -c 'import sys, json; print("true" if len(json.loads(sys.stdin.read())) > 0 else "false")')" | |
echo "output={\"directories\":${containers}}" >> "$GITHUB_OUTPUT" | |
echo "changed=${changed}" >> "$GITHUB_OUTPUT" | |
build-containers: | |
if: ${{ fromJSON(needs.detect-changes.outputs.changed) }} | |
needs: detect-changes | |
runs-on: ubuntu-latest | |
name: Build containers | |
strategy: | |
matrix: ${{ fromJSON(needs.detect-changes.outputs.directories) }} | |
permissions: | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: docker/setup-qemu-action@v2 | |
- uses: docker/setup-buildx-action@v2 | |
- uses: docker/login-action@v2 | |
if: github.event_name == 'push' | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- id: get-version | |
run: | | |
pip install tbump | |
echo "version=$(tbump -C dockerfiles/${{ matrix.directories }} current-version)" >> "$GITHUB_OUTPUT" | |
- run: | | |
pushd dockerfiles/${{ matrix.directories }} | |
export DOCKER_BUILDKIT=1 | |
make build | |
if [[ "${{ github.event_name }}" == "push" ]]; then | |
make push | |
fi |