Add initial version of the action

This commit is contained in:
Haralan Dobrev 2020-12-18 23:55:05 +02:00
parent 28994ef10d
commit 92e128b97c
5 changed files with 135 additions and 0 deletions

14
Dockerfile Normal file
View File

@ -0,0 +1,14 @@
FROM ubuntu:20.04
RUN apk update && apk upgrade && \
apk add wget
RUN wget https://dl.min.io/client/mc/release/linux-amd64/mc \
&& chmod +x mc \
&& ./mc --help
# Copies your code file from your action repository to the filesystem path `/` of the container
COPY entrypoint.sh /entrypoint.sh
# Code file to execute when the docker container starts up (`entrypoint.sh`)
ENTRYPOINT ["/entrypoint.sh"]

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 Haralan Dobrev
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

58
README.md Normal file
View File

@ -0,0 +1,58 @@
# Minio Deploy GitHub Action
Run [minio client][] in GitHub Actions to deploy files to Minio object storage.
It uses the `mc mirror --overwrite` command to deploy.
## Usage
Put the following step in your workflow:
```yml
- name: Minio Deploy
uses: hkdobrev/minio-deploy-action@v1
with:
endpoint: ${{ secrets.MINIO_ENDPOINT }}
access_key: ${{ secrets.MINIO_ACCESS_KEY }}
secret_key: ${{ secrets.MINIO_SECRET_KEY }}
bucket: 'mybucket'
# Optional inputs with their defaults:
source_dit: 'public'
target_dir: '/'
```
Workflow example:
```yml
name: Deploy
on:
pull_request:
types: [open, synchronize]
push:
branches:
- master
jobs:
build:
name: Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Minio Deploy
uses: hkdobrev/minio-deploy-action@v1
with:
endpoint: ${{ secrets.MINIO_ENDPOINT }}
access_key: ${{ secrets.MINIO_ACCESS_KEY }}
secret_key: ${{ secrets.MINIO_SECRET_KEY }}
bucket: 'mybucket'
source_dit: 'public'
target_dir: '/'
```
## License
Licensed under the MIT license. See [LICENSE](LICENSE).
[minio client]: https://docs.min.io/docs/minio-client-quickstart-guide

37
action.yml Normal file
View File

@ -0,0 +1,37 @@
name: 'Minio Deploy'
description: 'Deploy to Minio Storage'
author: 'hkdobrev'
inputs:
endpoint:
description: 'Minio endpoint of object storage host'
required: true
access_key:
description: 'Minio access key (username)'
required: true
secret_key:
description: 'Minio secret key (password)'
required: true
bucket:
description: 'Set the target minio bucket for deployment.'
required: true
source_dir:
description: 'Set an input directory for deployment.'
required: false
default: 'public'
target_dir:
description: 'Set a target directory for deployment (with a leading slash).'
required: false
default: '/'
runs:
using: 'docker'
image: 'Dockerfile'
env:
MINIO_ENDPOINT: ${{ inputs.endpoint }}
MINIO_ACCESS_KEY: ${{ inputs.access_key }}
MINIO_SECRET_KEY: ${{ inputs.secret_key }}
args:
- ${{ inputs.source_dir }}
- '${{ inputs.bucket }}${{ inputs.target_dir }}'
branding:
icon: 'upload-cloud'
color: 'red'

5
entrypoint.sh Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
mc alias set deploy $MINIO_ENDPOINT $MINIO_ACCESS_KEY $MINIO_SECRET_KEY
mc mirror --overwrite $1 "deploy/$2"