Skip to content

Commit

Permalink
Merge pull request #365 from PrestaShop/forcePublish
Browse files Browse the repository at this point in the history
Force publish if there are modifications in base directory
  • Loading branch information
Progi1984 authored Jan 25, 2024
2 parents ff97be0 + e7746e6 commit 788679f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ jobs:

- uses: actions/checkout@v2

## Check if there are modifications in the base/ directory
## and store it in the variable `steps.changes.outputs.base`
## The variable is built like: steps.{#id}.outputs.{#filter}
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
base:
- 'base/**'
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
Expand All @@ -52,10 +62,15 @@ jobs:
working-directory: base

- name: Base Images > Docker Build & Push
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && steps.changes.outputs.base != 'true' }}
run: ./docker_tags.sh -p
working-directory: base

- name: Base Images > Docker Build & Push
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && steps.changes.outputs.base == 'true' }}
run: ./docker_tags.sh -p -f
working-directory: base

- name: Install dependencies
run: pip install -r requirements.txt

Expand Down
1 change: 1 addition & 0 deletions base/config_files/ps-extractor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ if [[ -n "$folder" ]]; then
fi

chown www-data:www-data -R $folder/prestashop/
# Copy all files (included .env files)
cp -n -R -T -p $folder/prestashop/ /var/www/html
else
echo "Missing folder to move"
Expand Down
9 changes: 7 additions & 2 deletions base/docker_tags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ else
PS_VERSIONS_FILE="$1";
fi

while getopts ":p" option; do
FORCE=false
while getopts ":fp" option; do
case $option in
p)
PUSH=true
;;
f)
FORCE=true
;;
esac
done

Expand All @@ -22,8 +26,9 @@ docker_tag_exists() {

docker_image()
{
if docker_tag_exists prestashop/base ${version}; then
if ! $FORCE && docker_tag_exists prestashop/base ${version}; then
echo "Docker Image already pushed : prestashop/base:$version"
return
else
echo "Docker build & tag : prestashop/base:$version"
id=$(echo $(docker build --quiet=true images/${version} 2>/dev/null) | awk '{print $NF}')
Expand Down

0 comments on commit 788679f

Please sign in to comment.