Skip to content
This repository has been archived by the owner on Mar 6, 2021. It is now read-only.

Commit

Permalink
Fix: Usage examples in README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Aug 23, 2019
1 parent 69c0607 commit 2a016df
Showing 1 changed file with 58 additions and 19 deletions.
77 changes: 58 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,54 @@ That is, when you enable this action, the action will fail when a `composer.json

## Usage

Define a workflow in `.github/workflows/ci.yml` (or add a job if you alread have defined workflows) like this:
Define a workflow in `.github/workflows/ci.yml` (or add a job if you already have defined workflows).

:bulb: Read more about [Configuring a workflow](https://help.github.com/en/articles/configuring-a-workflow).

There are two ways of using this action:

* using the pre-built Docker image (faster)
* letting GitHub build the Docker image for you (slower)

### Pre-built Docker image

As an integration with [Travis CI](https://travis-ci.com) automatically builds and pushes a Docker image when a new tag is created in this repository, the recommended way to use this action is to reference the pre-built Docker image directly:

```yaml
name: CI

on: push

jobs:
composer-normalize:
name: composer-normalize
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: composer-normalize-action
uses: docker://localheinz/composer-normalize-action:latest
```
Instead of using the latest pre-built Docker image, you can also specify a Docker image tag (which corresponds to the tags available here on GitHub):
```yaml
name: CI

on: push

jobs:
composer-normalize:
name: composer-normalize
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: composer-normalize-action
uses: docker://localheinz/composer-normalize-action:0.4.2
```
### GitHub Repository
If you prefer to have GitHub to build the image for you, you can specify the repository instead:
```yaml
name: CI
Expand All @@ -24,10 +71,10 @@ jobs:
steps:
- uses: actions/checkout@master
- name: composer-normalize-action
uses: localheinz/composer-normalize-action
uses: localheinz/composer-normalize-action@master
```
You can also use a specific tag, for example, `x.y.z` (otherwise, `latest` will be used).
Instead of using the `master` branch, you can also specify a tag:

```yaml
name: CI
Expand All @@ -41,7 +88,7 @@ jobs:
steps:
- uses: actions/checkout@master
- name: composer-normalize-action
uses: localheinz/composer-normalize-action@0.4.1
uses: localheinz/composer-normalize-action@0.4.2
```

### Environment Variables
Expand All @@ -60,14 +107,18 @@ jobs:
steps:
- uses: actions/checkout@master
- name: composer-normalize-action
uses: localheinz/composer-normalize-action
uses: docker://localheinz/composer-normalize-action:0.4.2
env:
COMPOSER_NORMALIZE_VERSION: '^1.3.0'
```

The value can be a range (for example, `^1.3.0`) or an exact version (for example, `1.2.0`).
This value will be passed to [`entrypoint.sh`](entrypoint.sh) where it will be passed to

```
$ composer global require localheinz/composer-normalize:$COMPOSER_NORMALIZE_VERSION
```
:bulb: Also see [Automating your workflow with GitHub Actions](https://help.github.com/en/categories/automating-your-workflow-with-github-actions)
so it can be any value that is understood by [`composer`](https://getcomposer.org/doc/articles/versions.md).
## Examples
Expand All @@ -77,18 +128,6 @@ To see this action in action, take a look at the following checks:
* https://github.com/localheinz/composer-normalize-action-example/pull/2/checks
* https://github.com/localheinz/composer-normalize-action-example/pull/3/checks
## Docker

A docker image is automatically built and pushed to Docker Hub, see [`localheinz/composer-normalize-action`](https://cloud.docker.com/repository/docker/localheinz/composer-normalize-action).

You can execute the image by running

```
$ docker run --interactive --rm --tty --workdir=/app --volume ${PWD}:/app localheinz/composer-normalize-action
```
:bulb: Also see [Docker Docs: Docker run reference](https://docs.docker.com/engine/reference/run/).
## Changelog
Please have a look at [`CHANGELOG.md`](CHANGELOG.md).
Expand Down

0 comments on commit 2a016df

Please sign in to comment.