Skip to content

Commit

Permalink
Add mongo-action
Browse files Browse the repository at this point in the history
  • Loading branch information
DigiPie committed Mar 6, 2020
1 parent 0eda359 commit 3ae4702
Show file tree
Hide file tree
Showing 9 changed files with 478 additions and 46 deletions.
22 changes: 12 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
name: mongo-action CI
on: [push]

jobs:
hello_world_job:
test_mongo_action:
runs-on: ubuntu-latest
name: A job to say hello
name: Test mongo-action
steps:
- name: Hello world action step
id: hello
uses: actions/hello-world-docker-action@v1
with:
who-to-greet: 'Mona the Octocat'
# Use the output from the `hello` step
- name: Get the output time
run: echo "The time was ${{ steps.hello.outputs.time }}"
- name: Create mongo Docker container
id: build_mongo_docker
uses: DigiPie/[email protected]
- name: Install mongodb-clients
id: install_mongodb_clients
run: sudo apt install mongodb-clients
- name: Test mongo connection
id: test_mongo_connection
run: "sudo mongo localhost:27017"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
8 changes: 0 additions & 8 deletions Dockerfile

This file was deleted.

36 changes: 26 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
# mongo-action
Github action to create a Docker container from the official mongo image. Useful for testing purposes.

## Inputs
![mongo-action CI](https://github.com/DigiPie/mongo-action/workflows/mongo-action%20CI/badge.svg)

Github action to create a Docker container from the official mongo image. Useful for testing purposes. The MongoDB instance's port will be exposed to host and other containers.

### `who-to-greet`
## Inputs

**Required** The name of the person to greet. Default `"World"`.
### `image-version`

## Outputs
**Optional:** The `mongo` Docker image version to use. Default: `"latest"`.

### `time`
### `port`

The time we greeted you.
**Optional:** The `mongo` port to use. Default: `27017`.

## Example usage

uses: actions/hello-world-docker-action@v1
with:
who-to-greet: 'Mona the Octocat'
```yaml
on: [push]

jobs:
test_mongo_action:
runs-on: ubuntu-latest
name: Test mongo-action
steps:
- name: Create mongo Docker container
id: build_mongo_docker
uses: DigiPie/[email protected]
- name: Install mongodb-clients
id: install_mongodb_clients
run: sudo apt install mongodb-clients
- name: Test mongo connection
id: test_mongo_connection
run: "sudo mongo localhost:27017"
```
29 changes: 16 additions & 13 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# action.yml
name: 'Hello World'
description: 'Greet someone and record the time'
name: "mongo-action"
author: "Evan Tay"
description: "Github action to create a Docker container from the official mongo image."
branding:
icon: "database"
color: "green"
inputs:
who-to-greet: # id of input
description: 'Who to greet'
required: true
default: 'World'
outputs:
time: # id of output
description: 'The time we greeted you'
image_version:
description: "The mongo Docker image version to use"
required: false
default: "latest"
port:
description: "The MongoDB port to use"
required: false
default: 27017
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.who-to-greet }}
using: "node12"
main: "dist/index.js"
Loading

0 comments on commit 3ae4702

Please sign in to comment.