2021-04-12 00:50:55 +02:00
|
|
|
name: publishmultipledockerimages
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ docker-mods ]
|
|
|
|
paths:
|
|
|
|
- '**/Dockerfile'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
job1:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2021-04-12 01:16:40 +02:00
|
|
|
|
2021-04-12 00:50:55 +02:00
|
|
|
- name: get changed files
|
|
|
|
id: getfile
|
|
|
|
run: |
|
|
|
|
echo "::set-output name=files::$(git diff-tree --no-commit-id --name-only -r ${{ github.sha }}| xargs)"
|
|
|
|
|
2021-04-12 01:16:40 +02:00
|
|
|
- name: Login to GitHub Container Registry
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ secrets.PERSONAL_TOKEN }}
|
|
|
|
|
|
|
|
- name: echo the changed files and build&push
|
|
|
|
uses: docker/build-push-action@v2
|
2021-04-12 00:50:55 +02:00
|
|
|
run: |
|
|
|
|
for i in ${{ steps.getfile.outputs.files }}
|
|
|
|
do
|
|
|
|
directory="$( echo $i | cut -d'/' -f1 -s )"
|
|
|
|
if [ -z "$directory" ]; then
|
|
|
|
continue # Skip root dir
|
|
|
|
elif [ "$i" == *.md ]; then
|
|
|
|
continue # Skip markdown files
|
|
|
|
docker build . --file $i --tag theme.park:$directory
|
2021-04-12 01:16:40 +02:00
|
|
|
docker push ghcr.io/gilbn/theme.park:$directory
|
|
|
|
done
|