From f3f7131bee3bdf2913dcd2dadf219881e1a8ba80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=AE=E3=81=B6?= Date: Mon, 22 Jun 2020 14:49:09 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=97=E3=83=A9=E3=82=B0=E3=82=A4=E3=83=B3?= =?UTF-8?q?=E3=81=AE=E9=9B=9B=E5=BD=A2=E3=82=92=E4=BD=9C=E3=82=8B=E3=81=A8?= =?UTF-8?q?=E3=81=8D=E3=81=AB=20release.yml=20=E3=82=82=E5=90=8C=E6=A2=B1?= =?UTF-8?q?=E3=81=99=E3=82=8B=20=E5=87=BA=E6=9D=A5=E3=82=8C=E3=81=B0git=20?= =?UTF-8?q?clone=20=E3=81=A8=E3=81=8B=E3=81=A7=E3=81=A9=E3=81=93=E3=81=8B?= =?UTF-8?q?=E3=82=89=E3=81=8B=E5=8F=96=E3=81=A3=E3=81=A6=E3=81=93=E3=82=8C?= =?UTF-8?q?=E3=82=8B=E3=81=A8=E3=82=82=E3=81=A3=E3=81=A8=E3=81=84=E3=81=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Eccube/Command/PluginGenerateCommand.php | 43 ++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/Eccube/Command/PluginGenerateCommand.php b/src/Eccube/Command/PluginGenerateCommand.php index 482f0f5644b..db83c4298bf 100644 --- a/src/Eccube/Command/PluginGenerateCommand.php +++ b/src/Eccube/Command/PluginGenerateCommand.php @@ -117,6 +117,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->createNav($pluginDir, $code); $this->createTwigBlock($pluginDir, $code); $this->createConfigController($pluginDir, $code); + $this->createGithubActions($pluginDir); $this->io->success(sprintf('Plugin was successfully created: %s %s %s', $name, $code, $version)); } @@ -161,6 +162,7 @@ protected function createDirectories($pluginDir) 'Resource/doctrine', 'Resource/locale', 'Resource/template/admin', + '.github/workflows', ]; foreach ($dirs as $dir) { @@ -191,6 +193,47 @@ protected function createConfig($pluginDir, $name, $code, $version) $this->fs->dumpFile($pluginDir.'/composer.json', $source); } + + /** + * @param string $pluginDir + */ + protected function createGithubActions($pluginDir) + { + $source = ' +name: Packaging for EC-CUBE Plugin +on: + release: + types: [ published ] +jobs: + deploy: + name: Build + runs-on: ubuntu-18.04 + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Packaging + working-directory: ../ + run: | + rm -rf $GITHUB_WORKSPACE/.github + find $GITHUB_WORKSPACE -name "dummy" -delete + find $GITHUB_WORKSPACE -name ".git*" -and ! -name ".gitkeep" -print0 | xargs -0 rm -rf + chmod -R o+w $GITHUB_WORKSPACE + cd $GITHUB_WORKSPACE + tar cvzf ../${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.tar.gz ./* + - name: Upload binaries to release of TGZ + uses: svenstaro/upload-release-action@v1-release + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ runner.workspace }}/${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.tar.gz + asset_name: ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.tar.gz + tag: ${{ github.ref }} + overwrite: true +'; + + $this->fs->dumpFile($pluginDir.'/.github/workflows/release.yml', $source); + } + + /** * @param string $pluginDir */