Skip to content

Commit

Permalink
Merge pull request #261 from uzulla/issue39_233/ci-for-release
Browse files Browse the repository at this point in the history
tagを打った際にCIで配布ファイルを生成し、新規Releaseを作りつつ添付するアクションを追加
  • Loading branch information
fc2dev authored Mar 15, 2021
2 parents 0a411a6 + e55cb85 commit 4bf068f
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 5 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/release.yml
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
2 changes: 1 addition & 1 deletion dist_zip/.gitignore
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
42 changes: 39 additions & 3 deletions dist_zip/Makefile
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
2 changes: 1 addition & 1 deletion e2e_test/tests/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class Helper {
this.browser = await puppeteer.launch({
args: ['--lang=ja', '--no-sandbox', '--disable-setuid-sandbox'],
ignoreHTTPSErrors: true,
slowMo: 50, // sometime got `net::ERR_CONNECTION_REFUSED at http://localhost`. this is tweak...
slowMo: 100, // sometime got `net::ERR_CONNECTION_REFUSED at http://localhost`. this is tweak...
headless: !(process.env.NO_HEAD_LESS === "1") // 動作を確認するなら NO_HEAD_LESS=1 npm run test
});
this.page = await this.browser.newPage();
Expand Down

0 comments on commit 4bf068f

Please sign in to comment.