Skip to content

Commit

Permalink
feat: CD pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarofpp committed Jul 11, 2023
1 parent 66a0b09 commit dba6cce
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/delivery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
name: Delivery

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Publish the images that have changed.
run: |
FILES=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.before }} ${GITHUB_SHA})
readarray -t FILES_ARRAY <<< "$FILES"
IFS='/'
DOCKER_IMAGES=()
echo "${FILES_ARRAY}"
# for FILENAME in "${FILES_ARRAY[@]}"; do
# if [[ "$FILENAME" != *"/"* ]]; then
# continue
# fi
# if [[ "$FILENAME" == "."* ]]; then
# continue
# fi
#
# read -a PATHS <<< "$FILENAME"
# if [[ ! (${#PATHS[@]} > 2) ]]; then
# continue
# fi
#
# DOCKER_IMAGE_NAME="${{ secrets.DOCKERHUB_USERNAME }}/${PATHS[0]}:${PATHS[1]}"
# if [[ " ${DOCKER_IMAGES[@]} " =~ " ${DOCKER_IMAGE_NAME} " ]]; then
# continue
# fi
#
# docker build -t "${DOCKER_IMAGE_NAME}" ${PATHS[0]}/${PATHS[1]}/
# docker push "${DOCKER_IMAGE_NAME}"
# DOCKER_IMAGES+=($DOCKER_IMAGE_NAME)
# done

0 comments on commit dba6cce

Please sign in to comment.