Skip to content

Commit

Permalink
Integrate release
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesChou committed Mar 23, 2021
1 parent d7bca73 commit da67f15
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 15 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: "Release"

on:
push:
tags:
- "*"

env:
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --no-suggest --prefer-dist"

jobs:
build:
name: Upload Release Asset
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
tools: composer:v2
coverage: none

- name: Install Box package
run: composer global config minimum-stability dev && composer global require humbug/box ${{ env.COMPOSER_FLAGS }}

- name: Install Composer packages
run: composer install --no-dev ${{ env.COMPOSER_FLAGS }}

- name: Bump the version
run: ./bin/bump-version ${{ github.ref }}

- name: Build phar file
run: box compile

- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
body: TODO

- name: Upload phar
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./schemarkdown.phar
asset_name: schemarkdown.phar
asset_content_type: application/octet-stream
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress

- name: Bump the version
run: ./scripts/bump-version
run: ./bin/bump-version

- name: Execute phpcs
run: php vendor/bin/phpcs
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ container:
@docker-compose logs -f

bump:
@./scripts/bump-version ${VERSION}
@./bin/bump-version ${VERSION}

schemarkdown.phar: bump
@echo ">>> Building phar ..."
Expand Down
45 changes: 32 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
# Schemarkdown

[![Build Status](https://travis-ci.com/MilesChou/schemarkdown.svg?branch=master)](https://travis-ci.com/MilesChou/schemarkdown)
[![codecov](https://codecov.io/gh/MilesChou/schemarkdown/branch/master/graph/badge.svg)](https://codecov.io/gh/MilesChou/schemarkdown)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/4d50659b49da4ce797e7ad1ff5339c78)](https://www.codacy.com/manual/MilesChou/schemarkdown-cli)
[![Latest Stable Version](https://poser.pugx.org/MilesChou/schemarkdown/v/stable)](https://packagist.org/packages/MilesChou/schemarkdown)
[![Total Downloads](https://poser.pugx.org/MilesChou/schemarkdown/d/total.svg)](https://packagist.org/packages/MilesChou/schemarkdown)
[![License](https://poser.pugx.org/MilesChou/schemarkdown/license)](https://packagist.org/packages/MilesChou/schemarkdown)
[![Release](https://github.com/MilesChou/schemarkdown-cli/actions/workflows/release.yml/badge.svg)](https://github.com/MilesChou/schemarkdown-cli/actions/workflows/release.yml)
[![tests](https://github.com/MilesChou/schemarkdown-cli/actions/workflows/tests.yml/badge.svg)](https://github.com/MilesChou/schemarkdown-cli/actions/workflows/tests.yml)

The schema document generator.
The schema document generator and eloquent model generator for CLI, only.

Use the [schemarkdown](https://github.com/MilesChou/schemarkdown) library.

## Installation

Download the [Release](https://github.com/MilesChou/schemarkdown/releases) phar file and execute it:
Download the [Release](https://github.com/MilesChou/schemarkdown-cli/releases) phar file and execute it:

```bash
chmod +x schemarkdown.phar
Expand All @@ -27,27 +25,48 @@ schemarkdown

## Usage

### `schema:markdown`

In Laravel project, you can run this command immediately:

```bash
cd /path/to/your/project
schemarkdown
schemarkdown schema:markdown
```

Schema document are stored to `generated` directory default. Use the `--output-dir` option to change it.
Schema document are stored to `docs` directory default. Use the `--output-dir` option to change it.

In the other framework, you must provide config file like Laravel. Use `--config-file` option to specify custom config.
In the other framework, you must provide config file like Laravel. Use `--config-file` option to specify customize configuration.

This tool will load `.env` before load config. Use the `--env` option to specify .env path.

Use the `--connection` option to specify **connection name** in Laravel config to generate document of one database.
Use the `--connection` option to specify **connection name** in Laravel config to generate the document of one database.

Use the `--overwrite` option if you want to overwrite the exists document.

### `schema:model`

Just like `schema:markdown`, run this command directly:

```bash
cd /path/to/your-laravel-project
schemarkdown schema:model
```

It's will generate model code into `app/Models` directory (Laravel 8 default), use the `--output-dir` option can change output dir. If want to change namespace, use the `--namespace` option.

In the other framework but using Eloquent ORM library, you must provide config file like laravel project. Use `--config-file` option to specify customize configuration.

If only want build one connection, use the `--connection` option to specify.

Use the `--overwrite` option if you want to overwrite exist code.

## Example

Here is example [SQL](/examples/examples.sql), import MySQL and run following command:

```
php bin/schemarkdown.php --config-file=tests/Fixtures/database.php --connection=examples --output-dir=examples
php schemarkdown.phar --config-file=tests/Fixtures/database.php --connection=examples --output-dir=examples
```

It will generate this [Markdown documents](/examples).
Expand Down
File renamed without changes.

0 comments on commit da67f15

Please sign in to comment.