-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #261 from uzulla/issue39_233/ci-for-release
tagを打った際にCIで配布ファイルを生成し、新規Releaseを作りつつ添付するアクションを追加
- Loading branch information
Showing
4 changed files
with
105 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
release: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Setup PHP 8.0 | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.0' | ||
extensions: mbstring, gd, gettext, fileinfo, pdo, pdo_mysql, mysqli, zip | ||
|
||
- uses: actions/checkout@v2 | ||
|
||
- name: get composer | ||
run: | | ||
curl -sSfL -o composer-setup.php https://getcomposer.org/installer | ||
php composer-setup.php --filename=composer.phar | ||
rm composer-setup.php | ||
- name: composer install | ||
run: php composer.phar install --no-ansi --no-interaction --no-scripts --no-progress | ||
|
||
- name: pre build | ||
run: | | ||
cd dist_zip && make pre-build | ||
- name: create version file | ||
run: | | ||
VERSION=$(echo ${{ github.ref }} | sed -e "s#refs/tags/##g") | ||
cd dist_zip && echo $VERSION > fc2blog/app/version | ||
- name: make zip | ||
run: | | ||
cd dist_zip && make make-zip | ||
- name: create release | ||
id: create_release | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
draft: false | ||
prerelease: false | ||
|
||
- name: attach zip | ||
id: upload-release-asset | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: dist_zip/fc2blog_dist.zip | ||
asset_name: fc2blog_dist.zip | ||
asset_content_type: application/zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
fc2blog_dist_* | ||
fc2blog_dist.zip | ||
fc2blog/ | ||
test_vm/fc2blog_dist.zip | ||
test_vm/fc2blog_installer.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,57 @@ | ||
.PHONY: | ||
build: | ||
make clean | ||
echo `git branch --contains |cut -d " " -f 2` | ||
git clone --depth=1 --branch=`git branch --contains |cut -d " " -f 2` https://github.com/uzulla/fc2blog.git fc2blog | ||
rm -rf fc2blog/.git | ||
cd fc2blog && php ../../composer.phar install --no-dev --optimize-autoloader -q | ||
# get tag from current commit id. | ||
git tag -l --contains `git show -s --format=%H` > fc2blog/app/version | ||
# Set "dev" to contents/version, If contents/version is zero size file. | ||
if [ ! -s fc2blog/app/version ]; then echo "dev:"`git branch --contains |cut -d " " -f 2 | grep -e '.'`":"`git rev-parse --short HEAD` > fc2blog/app/version; fi | ||
cd fc2blog && zip -q -r ../fc2blog_dist.zip app public | ||
|
||
.PHONY: | ||
pre-build: | ||
make clean | ||
mkdir fc2blog | ||
cp -a ../app ../public ../composer.json ../composer.lock fc2blog | ||
-rm fc2blog/app/temp/installed.lock | ||
cd fc2blog && php ../../composer.phar install --no-dev --optimize-autoloader | ||
cd fc2blog && zip -r ../fc2blog_dist_`git rev-parse --short HEAD`.zip app public | ||
rm fc2blog/composer.* | ||
|
||
.PHONY: | ||
make-zip: | ||
cd fc2blog && zip -r ../fc2blog_dist.zip app public | ||
|
||
.PHONY: | ||
build-no-pushed-branch: | ||
make clean | ||
mkdir fc2blog | ||
cp -a ../app ../public ../composer.json ../composer.lock fc2blog | ||
-rm fc2blog/app/temp/installed.lock | ||
cd fc2blog && php ../../composer.phar install --no-dev --optimize-autoloader | ||
rm fc2blog/composer.* | ||
echo "dev:"`git branch --contains |cut -d " " -f 2 | grep -e '.'`":"`git rev-parse --short HEAD` > fc2blog/app/version | ||
cd fc2blog && zip -r ../fc2blog_dist.zip app public | ||
|
||
.PHONY: | ||
clean: | ||
-rm -rf fc2blog | ||
-rm fc2blog_dist_* | ||
-rm fc2blog_dist.zip | ||
-rm test_vm/fc2blog_dist.zip | ||
-rm test_vm/fc2blog_installer.php | ||
|
||
.PHONY: | ||
test: | ||
make build | ||
cp fc2blog_dist_`git -C fc2blog rev-parse --short HEAD`.zip test_vm/fc2blog_dist.zip | ||
cp fc2blog_dist.zip test_vm/fc2blog_dist.zip | ||
cp installer/fc2blog_installer.php test_vm/fc2blog_installer.php | ||
cd test_vm && make image && make bash | ||
|
||
.PHONY: | ||
test-no-pushed-branch: | ||
make build-no-pushed-branch | ||
cp fc2blog_dist.zip test_vm/fc2blog_dist.zip | ||
cp installer/fc2blog_installer.php test_vm/fc2blog_installer.php | ||
cd test_vm && make image && make bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters