Skip to content

Commit

Permalink
docs: Using a Mercure Service in GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Jan 12, 2021
1 parent 3057136 commit ae7f403
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/README.md
Expand Up @@ -24,4 +24,6 @@
## Ecosystem

* [Awesome Mercure: Libraries, Examples and Learning Resources](ecosystem/awesome.md)
* [Using a Mercure Service in Your GitHub Actions](ecosystem/github-actions.md)
* [Using Mercure and Hotwire to Stream Page Changes](ecosystem/hotwire.md)
* [Getting Help](ecosystem/help.md)
3 changes: 2 additions & 1 deletion docs/ecosystem/awesome.md
Expand Up @@ -40,7 +40,8 @@
* [Using Mercure and Hotwire to stream page changes](hotwire.md)
* [Laravel Mercure Broadcaster](https://github.com/mvanduijker/laravel-mercure-broadcaster)
* [Yii Mercure Behavior](https://github.com/bizley/mercure-behavior)
* [GitHub Actions for Mercure](https://github.com/Ilshidur/action-mercure)
* [Add a Mercure service in GitHub Actions](github-actions.md)
* [Send a Mercure publish event from GitHub Actions](https://github.com/Ilshidur/action-mercure)

## Useful Related Libraries

Expand Down
32 changes: 32 additions & 0 deletions docs/ecosystem/github-actions.md
@@ -0,0 +1,32 @@
# Using a Mercure Service in GitHub Actions

Adding a Mercure hub in your Continuous Integration system powered by GitHub Actions is straightforward:
create a [service container](https://docs.github.com/en/free-pro-team@latest/actions/guides/about-service-containers) and map its port on the host:

```yaml
name: Create a Mercure service

on: push

jobs:
my-job-using-mercure:
runs-on: ubuntu-latest

services:
mercure:
image: dunglas/mercure
env:
SERVER_NAME: :1337
MERCURE_PUBLISHER_JWT_KEY: '!ChangeMe!'
MERCURE_SUBSCRIBER_JWT_KEY: '!ChangeMe!'
MERCURE_EXTRA_DIRECTIVES: |
# Custom directives, see https://mercure.rocks/docs/hub/config
anonymous
cors_origins *
ports:
- 1337:1337
steps:
# ...
```

A Mercure hub is available at the address `http://localhost:1337/.well-known/mercure`.

0 comments on commit ae7f403

Please sign in to comment.