Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zalari/action-mc
A GitHub action for exposing the MinIO Client to your workflow for all your cheapo S3 needs
https://github.com/zalari/action-mc
Last synced: about 2 months ago
JSON representation
A GitHub action for exposing the MinIO Client to your workflow for all your cheapo S3 needs
- Host: GitHub
- URL: https://github.com/zalari/action-mc
- Owner: zalari
- License: mit
- Created: 2020-06-04T20:19:24.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-06-04T21:51:30.000Z (over 4 years ago)
- Last Synced: 2024-03-15T04:02:42.071Z (10 months ago)
- Language: Dockerfile
- Size: 6.84 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MC
A GitHub action for exposing the MinIO Client to your workflow for all your cheapo S3 needs## Usage
This example will create a S3 bucket called `testruction` at _service url_ `https://play.min.io` and set the `download` _policy_ for it.
```yml
- name: Create a bucket
uses: zalari/action-mc@master
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
MC_URL: https://play.min.io
MC_ALIAS: play
with:
args: mb create play/testruction -p
- name: Set anonymous download policy on bucket
uses: zalari/action-mc@master
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
MC_URL: https://play.min.io
MC_ALIAS: minio
with:
args: policy set download play/testruction
```
It is just a wrapper for the [MinIO Client](https://github.com/minio/mc).
Actual arguments are passed to the action via the `args` parameter.#### Secrets and environment variables
The following variables may be passed to the action as secrets or environment variables.
- `AWS_ACCESS_KEY_ID` (**required**) - The storage service access key id.
- `AWS_SECRET_ACCESS_KEY` (**required**) - The storage service secret access key.
- `MC_ALIAS` - The mc config host alias. _Defaults_ to `s3`
- `MC_URL` - The URL to the object storage service. _Defaults_ to `https://s3.amazonaws.com` for Amazon S3.
- `MC_API_SIGNATURE` - The api signature to use for creating the host config. _Defaults_ to `S3v4`, can alternatively `S3v2`.
- `MC_BUCKET_LOOKUP` - The bucket lookup to use for creating the host config. _Defaults_ to `auto`, can be `dns` or `path` as well.## Complete workflow example
The workflow copies everything from a `dist` dir to a newly dynamically generated bucket from the branch name with anonymous download policy set. Also known as poor man's netlify.
```yml
name: Poor man's netlify static site deployment
on:
push:
branches:
- master
jobs:
publish-to-public-bucket:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Create test data
run: mkdir dist && uptime > dist/uptime.txt
# taken from -> https://stackoverflow.com/questions/58033366/how-to-get-current-branch-within-github-actions#comment102508135_58034787
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF##*/})"
id: extract_branch
- name: Create a bucket from branch name
uses: zalari/action-mc@master
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
MC_URL: https://play.min.io
MC_ALIAS: play
with:
args: mb create play/testruction-${{ steps.extract_branch.outputs.branch }} -p
- name: Set anonymous download policy on bucket
uses: zalari/action-mc@master
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
MC_URL: https://play.min.io
MC_ALIAS: minio
with:
args: policy set download play/testruction-${{ steps.extract_branch.outputs.branch }}
- name: Upload dist to public bucket
uses: zalari/action-mc@master
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
MC_URL: https://play.min.io
MC_ALIAS: minio
with:
args: cp -r dist/ play/testruction-${{ steps.extract_branch.outputs.branch }}
```## License
[MIT](LICENSE)