Skip to content

Commit

Permalink
chore: build
Browse files Browse the repository at this point in the history
  • Loading branch information
apple-x-co committed Jul 18, 2022
1 parent c8fbc3a commit 7272188
Show file tree
Hide file tree
Showing 9 changed files with 205 additions and 21 deletions.
73 changes: 73 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name-template: 'v$RESOLVED_VERSION 🌈'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: '🚀 Features'
labels:
- 'feature'
- title: '💪 Enhancement'
labels:
- 'enhancement'
- title: '🐛 Bug Fixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: '🧰 Maintenance'
label: 'chore'
- title: '🔧 Refactoring'
label: 'refactor'
- title: '📖 Documentation'
label: 'documentation'
- title: '⛓️ Dependency update'
label: 'dependencies'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
patch:
labels:
- 'patch'
default: patch
template: |
## Changes
$CHANGES
autolabeler:
- label: feature
branch:
- '/^feat(ure)?[/-].+/'
title:
- '/^feat(ure)?[/-].+/'
- label: bug
branch:
- '/^fix[/-].+/'
title:
- '/^fix[/-].+/'
- label: chore
branch:
- '/^chore[/-].+/'
title:
- '/^chore[/-].+/'
- label: refactor
branch:
- '/(refactor|refactoring)[/-].+/'
title:
- '/(refactor|refactoring)[/-].+/'
- label: documentation
branch:
- '/doc(umentation)[/-].+/'
title:
- '/doc(umentation)[/-].+/'
files:
- '*.md'
- label: enhancement
branch:
- '/(enhancement|improve)[/-].+/'
- label: github
files:
- '.github/**/*'
51 changes: 51 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Publish

on:
release:
types:
- published

jobs:
build:
name: Release build
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '5.4'

# - name: Setup PHP
# uses: shivammathur/setup-php@v2
# with:
# php-version: '7.4'
#
# - name: Get composer cache directory
# id: composer-cache
# run: echo "::set-output name=dir::$(composer config cache-files-dir)"
#
# - name: Cache dependencies
# uses: actions/cache@v2
# with:
# path: ${{ steps.composer-cache.outputs.dir }}
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
# restore-keys: ${{ runner.os }}-composer-
#
# - name: Install dependencies
# run: composer install --no-interaction --no-progress --prefer-dist

- name: Download latest phar-composer.phar
run: composer run-script download-phar-composer

- name: Build phar
run: composer run-script build

- name: Upload Release Asset
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: rocket.phar
45 changes: 45 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Release Drafter

on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- main
# pull_request event is required only for autolabeler
pull_request:
# Only following types are handled by the action, but one can default to all as well
types: [opened, reopened, synchronize]
# pull_request_target event is required for autolabeler to support PRs from forks
# pull_request_target:
# types: [opened, reopened, synchronize]

permissions:
contents: read

jobs:
release_draft:
name: Release draft
runs-on: ubuntu-latest
permissions:
contents: write # for release-drafter/release-drafter to create a github release
pull-requests: write # for release-drafter/release-drafter to add label to PR
outputs:
name: ${{ steps.release_drafter.outputs.name }}
tag_name: ${{ steps.release_drafter.outputs.tag_name }}
body: ${{ steps.release_drafter.outputs.body }}
upload_url: ${{ steps.release_drafter.outputs.upload_url }}
steps:
# (Optional) GitHub Enterprise requires GHE_HOST variable set
#- name: Set GHE_HOST
# run: |
# echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV

# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5
id: release_drafter
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
# with:
# config-name: my-config.yml
# disable-autolabeler: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ composer.phar
# composer.lock

###
/dist/

composer.lock
/build/
phar-composer.phar
rocket.phar
24 changes: 10 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,15 @@
## Installation

```bash
wget https://github.com/apple-x-co/rocket/releases/download/0.1.7/rocket.phar
wget https://github.com/apple-x-co/rocket/releases/latest/download/rocket.phar
chmod u+x rocket.phar
./rocket.phar --init > ./rocket.json
```

```bash
# slack notification test
./rocket.phar --config ./rocket.json --notify-test
## Information

# verify rocket.json
./rocket.phar --config ./rocket.json --verify
```bash
./rocket.phar --info #--no-color
```

## Update
Expand All @@ -29,6 +27,12 @@ chmod u+x rocket.phar
## Usage

```bash
# slack notification test
./rocket.phar --config ./rocket.json --notify-test

# verify rocket.json
./rocket.phar --config ./rocket.json --verify

# dry run (default)
./rocket.phar --config ./rocket.json --sync dry

Expand All @@ -44,11 +48,3 @@ chmod u+x rocket.phar
# notify
cat example.txt | ./rocket.phar --config ./rocket.json --notify
```

## Build phar file

```bash
composer run-script build
```

※ プロジェクト内の全てのファイルが圧縮されます。資格情報ファイルなどは配置しないでください。
12 changes: 12 additions & 0 deletions bin/build.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

passthru('
rm -rf build && mkdir build
cp -r bin src composer.json build/ && rm build/bin/build.php &&
composer config -d build/ platform.php 5.6 &&
composer install -d build/ --no-dev &&
php -d phar.readonly=off ./phar-composer.phar build build/ &&
php ./rocket.phar --info --no-color
', $code);

exit($code);
File renamed without changes.
13 changes: 8 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{
"name": "apple-x-co/rocket",
"description": "git & rsync & slack",
"description": "deploy tool",
"authors": [
{
"name": "apple-x-co",
"email": "[email protected]"
}
],
"bin": [
"bin/run.php"
"bin/rocket.php"
],
"require": {
"php": "^5.4",
"ext-curl": "*",
"ext-json": "*",
"ext-posix": "*",
Expand All @@ -22,12 +23,14 @@
}
},
"scripts": {
"build": "rm -rf dist/rocket.phar; phar-composer build .; mv -f rocket.phar dist/rocket.phar; chmod u+x dist/rocket.phar",
"info": "dist/rocket.phar --info --no-color"
"information": "@php rocket.phar --info --no-color",
"download-phar-composer": "curl --silent --show-error --location https://clue.engineering/phar-composer-latest.phar --output phar-composer.phar",
"build": "@php bin/build.php"
},
"config": {
"sort-packages": true,
"platform": {
"php": "5.6"
"php": "5.4"
}
}
}
2 changes: 1 addition & 1 deletion src/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

class Version
{
const ROCKET_VERSION = '0.1.12';
const ROCKET_VERSION = '0.1.13';
}

0 comments on commit 7272188

Please sign in to comment.