forked from mirromutth/mysql-action
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
60f8cfb
commit 9e1c6ff
Showing
5 changed files
with
66 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### MacOS | ||
|
||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM docker:stable | ||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
RUN chmod +x /entrypoint.sh | ||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,23 @@ | ||
# mysql-action | ||
GitHub Action to setup a MySQL database | ||
# MySQL GitHub Action | ||
|
||
This [GitHub Action](https://github.com/features/actions) sets up a MySQL database. | ||
|
||
## Usage | ||
|
||
```yaml | ||
steps: | ||
- uses: mirromutth/mysql-action@v1 | ||
with: | ||
mysql password: ${{ secrets.databasePassword }} # Required, the password of the superuser for the specified database | ||
mysql user: 'developer' # Optional, default value is "test", the superuser for the specified database. Of course you can use secrets, too | ||
mysql version: '8.0' # Optional, default value is "latest", the version of the MySQL in Docker | ||
mysql database: 'some_test' # Optional, default value is "test", the specified database which will be create | ||
``` | ||
See [Docker Hub](https://hub.docker.com/_/mysql) for available versions. | ||
See [Creating and using secrets (encrypted variables)](https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables) for hiding database password. | ||
## License | ||
This project is released under the [MIT License](LICENSE). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: 'Setup MySQL' | ||
description: 'Setup a MySQL database' | ||
author: 'Mirro Mutth' | ||
branding: | ||
icon: 'database' | ||
color: 'orange' | ||
inputs: | ||
# See https://hub.docker.com/_/mysql for supported versions and further details on input environment variables | ||
mysql version: | ||
description: 'Version of MySQL to use' | ||
required: false | ||
default: 'latest' | ||
mysql database: | ||
description: 'MYSQL_DATABASE - name for the default database that is created' | ||
required: false | ||
default: 'test' | ||
mysql user: | ||
description: 'MYSQL_USER - create the specified user with superuser power for created database' | ||
required: false | ||
default: 'test' | ||
mysql password: | ||
description: 'MYSQL_PASSWORD - superuser password' | ||
required: true | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
|
||
docker_run="docker run -e MYSQL_RANDOM_ROOT_PASSWORD=true" | ||
docker_run="$docker_run -e MYSQL_DATABASE=$INPUT_MYSQL_DATABASE" | ||
docker_run="$docker_run -e MYSQL_USER=$INPUT_MYSQL_USER" | ||
docker_run="$docker_run -e MYSQL_PASSWORD=$INPUT_MYSQL_PASSWORD" | ||
docker_run="$docker_run -d -p 3306:3306 mysql:$INPUT_MYSQL_VERSION" | ||
|
||
sh -c "$docker_run" |