-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Transform shop zipping and push to artifacts into a reusable action
- Loading branch information
1 parent
e31501d
commit d39abf1
Showing
4 changed files
with
87 additions
and
30 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Archive shop | ||
description: Archive shop to share with future jobs, the action exports sources sql and xml checksum (optional) | ||
inputs: | ||
ps_dir: | ||
description: Directory target | ||
required: true | ||
db_user: | ||
description: DB user | ||
required: true | ||
db_password: | ||
description: DB password | ||
required: true | ||
db_name: | ||
description: DB name | ||
required: true | ||
artifact_name: | ||
description: Artifact name, used later for download | ||
required: false | ||
default: shop-artifacts | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Archive shop content | ||
run: | | ||
mkdir -p /tmp/${{ inputs.artifact_name }} | ||
pushd ${{ inputs.ps_dir }}; zip -q -r /tmp/${{ inputs.artifact_name }}/sources.zip * -x \ | ||
"*/admin-dev/themes/new-theme/node_modules/**/*" \ | ||
"*/admin-dev/themes/default/node_modules/**/*" \ | ||
"*/themes/classic/_dev/**/*" \ | ||
"*/themes/_core/**/*" \ | ||
"*/themes/node_modules/**/*" \ | ||
"*/install-dev/**/*" \ | ||
"*/translations/*.zip" \ | ||
"*/var/cache/**/*" \ | ||
"*/tests/Integration/**/*" \ | ||
"*/tests/Resources/**/*" \ | ||
"*/tests/Unit/**/*" \ | ||
"*/.git/**/*"; popd | ||
docker exec my_prestashop_mysql_1 /usr/bin/mysqldump -u ${{ inputs.db_user }} -p${{ inputs.db_password }} ${{ inputs.db_name }} > /tmp/${{ inputs.artifact_name }}/db_dump.sql | ||
shell: bash | ||
|
||
- name: Upload shop artifacts "${{ inputs.artifact_name }}" | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ inputs.artifact_name }} | ||
path: /tmp/${{ inputs.artifact_name }} |
31 changes: 31 additions & 0 deletions
31
.github/workflows/actions/archive-shop/download/action.yml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Download archive shop | ||
description: Download archive shop and extracts it to the specified folder | ||
inputs: | ||
target_folder: | ||
description: Target folder for extraction | ||
required: true | ||
artifact_name: | ||
description: Artifact name, used later for download | ||
required: false | ||
default: shop-artifacts | ||
outputs: | ||
source-path: | ||
description: Path to the sources zip file | ||
value: /tmp/${{ inputs.artifact_name }}/sources.zip | ||
db-dump-path: | ||
description: Path to the sources zip file | ||
value: /tmp/${{ inputs.artifact_name }}/db_dump.sql | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Download docker artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ inputs.artifact_name }} | ||
path: /tmp/${{ inputs.artifact_name }} | ||
|
||
- name: Extract PrestaShop sources | ||
run: | | ||
unzip /tmp/${{ inputs.artifact_name }}/sources.zip -d ${{ inputs.target_folder }} | ||
shell: bash |
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
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