Create module ZIP #239
This file contains hidden or 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
| name: Create module ZIP | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| environment: | |
| description: "Select environment (GITHUB or MARKETPLACE)" | |
| required: true | |
| default: "GITHUB" | |
| type: choice | |
| options: | |
| - GITHUB | |
| - MARKETPLACE | |
| jobs: | |
| prepare-zip: | |
| name: Prepare module ZIP artifact | |
| runs-on: ubuntu-latest | |
| env: | |
| MODULE_NAME: mollie | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Choose environment | |
| run: | | |
| make create-env env=${{ inputs.environment }} | |
| - name: Build module ZIP | |
| run: | | |
| composer install --no-dev --optimize-autoloader --classmap-authoritative | |
| composer dump-autoload --no-dev --optimize --classmap-authoritative | |
| cd views/js/admin/library && npm install && npm run build | |
| rm -rf node_modules src | |
| cd ../../../.. | |
| rm -rf .git .docker .editorconfig .github tests .php-cs-fixer.php Makefile cypress .docker cypress.config.js cypress.env.json docker-compose*.yml .gitignore bin codeception.yml package-lock.json package.json .php_cs.dist .php-cs-fixer.dist .php-cs-fixer.dist.php | |
| # PrestaShop security requirement: every shipped directory must contain an index.php | |
| find . -type d ! -path './.git' ! -path './.git/*' | while read -r dir; do [ -f "$dir/index.php" ] || cp index.php "$dir/index.php"; done | |
| mkdir ${{ env.MODULE_NAME }} | |
| rsync -Rr ./ ./${{ env.MODULE_NAME }} | |
| shopt -s extglob | |
| rm -r !(${{ env.MODULE_NAME }}) | |
| find . -maxdepth 1 -type f -exec rm "{}" \; | |
| cd ${{ env.MODULE_NAME }} && rm -rf ${{ env.MODULE_NAME }} | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| include-hidden-files: true | |
| name: ${{ env.MODULE_NAME }} | |
| path: ./ |