Skip to content

Commit

Permalink
[ECP-8954] Automate the Shopware Marketplace zip file creation as rel…
Browse files Browse the repository at this point in the history
…ease asset (#500)

* Added new workflow file and script for creating zip

* Fixed syntax in yml file

* Update the path to prepare script in yml file

* Add a testing script with e2e file

* Update the file path syntax

* Update working directory path

* Try something new

* Try something new with the zip path

* hopefully this fixed the path

* hopefully this fixed the path - 2

* hopefully this fixed the path - 3

* hopefully this fixed the path - 4

* hopefully this fixed the path - 5

* last trial of the day

* move zip file inside pwd

* Finish up

* Remove copy

* Update comments

* Add upload asset into workflow

* try to use the upload artifact action for uploading release asset

* path var update

* Action update

* add tag

* always

* try latest action

* try another one

* update input variable

* try CLI

* fix syntax

* fix syntax

* add token

* remove @

* find the file

* trying to user form data.

* setting the content type and using the upload url.

* oops.. upload_url instead of release id

* fight the zip corruption

* fight the zip corruption -1

* Update checkout version in mail.yml to get rid of deprecation warnings

* remove usage of set-output

* Test and revert

* revert url var too

* test env vars

* change syntax

* again

* change mime type

* raw field instead of field

* back to the basics..

* added ls again to check (and data key)

* try something new

* try upload with cli command using tag-name

* Clean up and try upload with cli command using tag-name - 2

* Go back to old method

* See if Readme file gets corrupted too on upload

* syntax fix

* rearrange commented code

* syntax fix again

* Check for readme

* Correct file type

* Now try the same method for the zip

* Oops! forgot to compile the zip

* Since it finally works - optimize code

* Finalise

* Update trigger to 'release'

* Remove the push trigger

* Apply suggestions from review

* Remove missed commented code

* Create a zip file for test and use the ref name instead of 'latest' for getting release information

* Remove 'workflow_dispatch' trigger and get a zip file with 'push' trigger

* Remove 'push' trigger and add back the usage of ref name

* test the trigger type 'edited' for release

* test the trigger type 'published' for release

* [ECP-8954] Use tag name directly

---------

Co-authored-by: sushmita <[email protected]>
  • Loading branch information
candemiralp and sushmita authored May 22, 2024
1 parent a8a59eb commit b116321
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
php-version: ${{ matrix.php-version }}

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Validate composer.json and composer.lock
run: composer validate
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/scripts/prepare-release-asset.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

# Create a copy of the plugin directory
cd ..
cp -r adyen-shopware6 AdyenPaymentShopware6

# Remove Shopware dependencies
composer remove shopware/core --working-dir=./AdyenPaymentShopware6
composer remove shopware/storefront --working-dir=./AdyenPaymentShopware6

# Remove composer.lock again and vendor directory
rm AdyenPaymentShopware6/composer.lock
rm -rf AdyenPaymentShopware6/vendor

# Install dependencies
composer install --no-dev --working-dir=./AdyenPaymentShopware6

# Copy original the composer.json file
cp adyen-shopware6/composer.json AdyenPaymentShopware6/.

# Zip the plugin directory
zip -r AdyenPaymentShopware6.zip AdyenPaymentShopware6/ ;

# Move the zip file to plugin folder
mv AdyenPaymentShopware6.zip adyen-shopware6

# Cleanup the zip installation
zip -d AdyenPaymentShopware6.zip __MACOSX/\* ; zip -d AdyenPaymentShopware6.zip *.git*

# Go back to workflow's root directory
cd adyen-shopware6
22 changes: 22 additions & 0 deletions .github/workflows/upload-release-asset.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
on:
release:
types: [published]

name: Upload Shopware 6 Marketplace asset

jobs:
run:
name: Upload Release Asset
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Prepare release artifact
run: .github/workflows/scripts/prepare-release-asset.sh

- name: Upload asset
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ github.ref_name }} AdyenPaymentShopware6.zip --clobber

0 comments on commit b116321

Please sign in to comment.