Skip to content

Commit

Permalink
プラグインの雛形を作るときに release.yml も同梱する
Browse files Browse the repository at this point in the history
出来ればgit clone とかでどこからか取ってこれるともっといい
  • Loading branch information
nobuhiko committed Jun 22, 2020
1 parent aa9f059 commit f3f7131
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions src/Eccube/Command/PluginGenerateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down Expand Up @@ -161,6 +162,7 @@ protected function createDirectories($pluginDir)
'Resource/doctrine',
'Resource/locale',
'Resource/template/admin',
'.github/workflows',
];

foreach ($dirs as $dir) {
Expand Down Expand Up @@ -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
*/
Expand Down

0 comments on commit f3f7131

Please sign in to comment.