From 2e4008842000606a3bd8868496f48af25e511b77 Mon Sep 17 00:00:00 2001 From: TapTap21 Date: Mon, 2 Nov 2020 09:05:56 +0200 Subject: [PATCH] ADD build release --- .github/workflows/release.yml | 27 +++++++++++++ README.md | 73 ++++++++++++++++++++++++++++++++++- action.yml | 5 +-- 3 files changed, 100 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a7351a5 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,27 @@ +name: Example usage + +on: + release: + types: + - created + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + context: ./ + file: ./Dockerfile + push: true + tags: | + taptap21/docker-remote-deployment-action:latest + taptap21/docker-remote-deployment-action:${{ github.event.release.tag_name }} + + + diff --git a/README.md b/README.md index 4f194c6..b655182 100644 --- a/README.md +++ b/README.md @@ -1 +1,72 @@ -# docker-remote-deployment-action \ No newline at end of file +# Docker Deployment Action +A [GitHub Action](https://github.com/marketplace/actions/docker-deployment) for docker-compose deployments on a remote host using SSH. +TODO: Update action URL +The Action is adapted from work by [wshihadeh](https://github.com/marketplace/actions/docker-deployment) + + +## Example + +Below is an example of how the action can be used + +```yaml +- name: Start Deployment + uses: TapTap21/docker-remote-deployment-action@v1.0 + with: + remote_docker_host: ec2-user@ec2-34-246-134-80.eu-west-1.compute.amazonaws.com + ssh_private_key: ${{ secrets.DOCKER_SSH_PRIVATE_KEY }} + ssh_public_key: ${{ secrets.DOCKER_SSH_PUBLIC_KEY }} + stack_file_name: docker-compose.yml + docker_login_password: ${{ secrets.DOCKER_REPO_PASSWORD }} + docker_login_user: ${{ secrets.DOCKER_REPO_USERNAME }} + docker_login_registry : ${{ steps.login-ecr.outputs.registry }} + args: -p myapp up -d +``` + +Use the latest tag to run the latest build or a specific version tag. The action pulls a docker image instead of building one to improve performance. +## Input + +Below is a breakdown of the expected action inputs. + +### `args` + +Docker-compose runtime arguments and options. Below is a common usage example: + +- `-p app_stack_name -d up` + +### `remote_docker_host` + +Specify Remote Docker host. The input value must be in the following format (user@host) + +### `ssh_public_key` + +Remote Docker SSH public key. + +### `ssh_private_key` + +SSH private key used to connect to the docker host. + +SSH key must be in PEM format (begins with -----BEGIN RSA PRIVATE KEY-----) + +### `ssh_port` + +The SSH port to be used. Default is 22. + +### `stack_file_name` + +Docker stack file used. Default is docker-compose.yml + +### `docker_login_user` + +The username for the container repository user. (DockerHub, ECR, etc.) + +### `docker_login_password` + +The password for the container repository user. + +### `docker_login_registry` + +The docker container registry to authenticate against + +## License + +This project is licensed under the MIT license. See the [LICENSE](LICENSE) file for details. \ No newline at end of file diff --git a/action.yml b/action.yml index 94ce9cf..7f331f6 100644 --- a/action.yml +++ b/action.yml @@ -17,9 +17,6 @@ inputs: stack_file_name: description: Docker stack file used. Default is docker-compose.yaml required: false - pre_deployment_command_args: - description: The args for the pre deploument command. - required: false ssh_port: description: The ssh port of the server. Default is 22 required: false @@ -35,7 +32,7 @@ inputs: runs: using: docker - image: Dockerfile + image: docker://taptap21/docker-remote-deployment-action:v1.0 branding: icon: send