Skip to content

minor update

minor update #15

Workflow file for this run

name: Publish Docker image
on: [push]
jobs:
dirs:
name: Get docker dirs
runs-on: ubuntu-latest
outputs:
docker-dirs: ${{ steps.get-directory-names.outputs.directory-names }}
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Collect Directory Names by File
id: get-directory-names
uses: featherweight-design/collect-directory-names-by-file-glob@v1.2.2
with:
file-glob: "**/Dockerfile"
search-directory: "/images"
unique: "true"
push_to_registry:
name: Push Docker image to GitHub Packages
runs-on: ubuntu-latest
needs: dirs
strategy:
matrix:
dir: ${{ fromJSON(needs.dirs.outputs.docker-dirs) }}
permissions:
packages: write
contents: read
steps:
- name: Branch name
id: branch_name
run: |
echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/}
echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/}
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
- uses: benjlevesque/short-sha@v1.2
id: short-sha
with:
length: 7
- name: Check out the repo
uses: actions/checkout@v2
- id: changes
uses: dorny/paths-filter@v2
with:
filters: |
src:
- 'images/${{matrix.dir}}/**'
- name: Log in to Docker Registry
uses: docker/login-action@v1
with:
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push ${{matrix.dir}} container image
uses: docker/build-push-action@v2
with:
context: ./images/${{matrix.dir}}/
push: true
tags: |
docker.io/spovedio/${{matrix.dir}}:${{ steps.short-sha.outputs.sha }}
docker.io/spovedio/${{matrix.dir}}:${{ steps.branch_name.outputs.SOURCE_BRANCH }}
- name: Push latest
uses: docker/build-push-action@v2
if: steps.changes.outputs.src == 'true'
with:
context: ./images/${{matrix.dir}}/
push: true
tags: |
docker.io/spovedio/${{matrix.dir}}:latest