Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Take only a folder of a release zip? #5

Closed
goaround opened this issue Feb 2, 2021 · 4 comments
Closed

Take only a folder of a release zip? #5

goaround opened this issue Feb 2, 2021 · 4 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@goaround
Copy link

goaround commented Feb 2, 2021

Hi,

first: thank you very much for this composer plugin!

I have a suggestion for pre-compiled adapter: It would be helpful to take only a part e.g. the dist or asset folder from the zip file and place it in the target folder.

Often you attach a compiled zip to the Github release with all the files but just need one folder with the assets.

@Chrico Chrico added the help wanted Extra attention is needed label Feb 3, 2021
@Chrico
Copy link
Member

Chrico commented Feb 3, 2021

Good morning @goaround

could you pls show your asset-compiler.json or asset-compiler-setting in composer.json and the Github Action? :) As far is i unterstand you want to create a release zip (when creating a release) and/or build artifact (when pushing into repo) which only contains the asset-folder and on the other end you want to unzip this folder again?

@goaround
Copy link
Author

goaround commented Feb 3, 2021

Good moring @Chrico

take a look at this release: https://github.com/deworg/dewp-planet-feed/releases/tag/0.5.1 It comes with a dewp-planet-feed-0.5.1.zip asset. It contains the whole plugin including the assets folder. I just need the assets from this zip because I load the rest of the plugin through composer.

With this asset-compiler.json it unpacks the whole zip to the /assets dir.

{
    "script": "production",
    "pre-compiled": {
        "env": {
            "root": {
                "adapter": false
            },
            "$default": {
                "source": "dewp-planet-feed-${version}",
                "target": "./assets/",
		"adapter": "gh-release-zip",
		"config": {
		   "repository": "deworg/dewp-planet-feed"
		}
            }
        }
    }
}

grafik

@gmazzap
Copy link
Contributor

gmazzap commented Feb 3, 2021

@goaround the solution IMO is that in your worflow file you create a zip with just the assets.

So right after this line: https://github.com/deworg/dewp-planet-feed/blob/master/.github/workflows/deploy-workflow.yml#L31

you could add:

zip -r dewp-planet-feed-assets.zip dewp-planet-feed/assets/

creating another zip for just assets,

and then, at the end of the worflow, you add an additional step:

    - name: Upload assets ZIP to release.
      uses: actions/upload-release-asset@v1
      with:
        upload_url: ${{ steps.get_release.outputs.upload_url }}
        asset_path: ./dewp-planet-feed-assets.zip
        asset_name: dewp-planet-feed-assets.zip
        asset_content_type: application/zip

(I'm not sure actions/upload-release-asset allow upload multiple assets at once, if so you could combine the two steps uploading zips in one step).

At that point, your configuration you could be:

{
    "script": "production",
    "pre-compiled": {
        "env": {
            "root": {
                "adapter": false
            },
            "$default": {
                "source": "dewp-planet-feed-assets.zip",
                "target": "./assets/",
		"adapter": "gh-release-zip",
		"config": {
		   "repository": "deworg/dewp-planet-feed"
		}
            }
        }
    }
}

Addding an additional configuration to target a single folder would require some more compexity due to manage yet another config value, plus dealing with it when unpacking the zip.

Considering that this is something doable already I'm not sure I want to implement that... I'll have to think about it. Opinions? (also @Chrico)

@goaround
Copy link
Author

goaround commented Feb 4, 2021

Thank you. I now generate an additional assets.zip and this works fine.

@gmazzap gmazzap closed this as completed Feb 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants