afragen / git-updater

This WP plugin will update GitHub, Bitbucket, GitLab, and Gitea hosted plugins and themes
https://git-updater.com
MIT License
3.19k stars 462 forks source link

GitLab release with composer dependencies #819

Closed noplanman closed 4 years ago

noplanman commented 4 years ago

I'm basically looking for a way to use GitLab CI to build a production plugin (composer install --no-dev) and zip the clean file structure without any development stuff.

After many failed attempts using GitLab CI Job: build-plugin and Release Asset: true I'm coming here to figure out what I'm doing wrong...

What exactly needs to be built as an artifact for GitHub Updater to install it successfully?

Here is my simple example of a .gitlab-ci.yml file:

build-plugin:
  only:
  - tags
  image: php:7.3-cli-alpine
  script:
  - apk -U add git zip
  - curl -sS https://getcomposer.org/installer | php
  - php composer.phar install --no-dev --no-interaction
  # Zip only required files
  - zip -r /tmp/plugin.zip . -i@.ziponly
  # Delete everything
  - rm -rf $(ls -A)
  # Unzip only necessary files back here for the artifact itself
  - unzip /tmp/plugin.zip -d .
  artifacts:
    name: "${CI_PROJECT_NAME}-${CI_COMMIT_TAG}"
    paths: [.]
    expire_in: 1 week

(.ziponly is a file that contains a list of files that are required for the production plugin)

This creates an artifact with the correct name: <repo>-<tag>.zip

But when updating, it breaks after creating the first folder and that folder stays empty:

- plugin.php
- vendor (empty)

What it should be:

- plugin.php
- lib
  - (all libs etc.)
- vendor
  - (all vendor files)

Any guidance would be much appreciated, thanks :smiley:

afragen commented 4 years ago

If you can download the build-plugin from the download link you should be able to use GHU as you have it set up.

If you can give me read access I might be able to help more. Same username as here.

afragen commented 4 years ago

I can’t really help with any CI questions. My lack of knowledge.

noplanman commented 4 years ago

Thanks for your reply @afragen.

I saw that the problem seems to be WordPress related, but I haven't fully understood why :thinking: It's having trouble moving the files from the upgrade folder (which does contain the full plugin contents correctly) to the actual plugin folder.

I'll close off here as it seems unrelated.