Compare commits

...

10 Commits
v1.0.2 ... main

Author SHA1 Message Date
Vladimir Levin 44c9f09e70 Tricks section 2023-08-06 20:56:46 +09:00
Vladimir Levin 68fc785123 Small revamp 2023-08-06 20:39:49 +09:00
Vladimir Levin 3afecdfe52 Minor fix 2023-08-06 20:34:43 +09:00
Vladimir Levin 281bdfb13d Stable 2023-08-06 19:39:17 +09:00
Vladimir Levin 355a3e83a2 Stable 2023-08-06 18:03:46 +09:00
Vladimir Levin a68b9910d6 Update entrypoint 2023-08-06 17:58:00 +09:00
Vladimir Levin 44bb614a8b Fix recursive bug 2023-08-06 17:51:57 +09:00
Vladimir Levin 074a496f4e PATH changes 2023-08-06 17:34:47 +09:00
Vladimir Levin 04c4ba64c6 Move from bash 2023-08-06 17:28:31 +09:00
Vladimir Levin 9d6c3b12aa FIxed shebang 2023-08-06 17:25:48 +09:00
4 changed files with 43 additions and 14 deletions

19
.github/workflows/auto-assign.yaml vendored Normal file
View File

@ -0,0 +1,19 @@
name: Auto Assign
on:
issues:
types: [opened]
pull_request:
types: [opened]
jobs:
run:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- name: 'Auto-assign issue'
uses: pozil/auto-assign-issue@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
assignees: opa-oz
numOfAssignee: 1

View File

@ -3,11 +3,8 @@ LABEL authors="Vladimir <opa_oz> Levin"
RUN curl https://dl.min.io/client/mc/release/linux-amd64/mc \
--create-dirs \
-o $HOME/minio-binaries/mc
RUN chmod +x $HOME/minio-binaries/mc
RUN export PATH=$PATH:$HOME/minio-binaries/
-o /minio-binaries/mc
RUN chmod +x /minio-binaries/mc
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

View File

@ -1,27 +1,39 @@
# Yet another MinIO Upload GitHub Action
🥳Check also [Yet another MinIO Download GitHub Action](https://github.com/yakubique/minio-download)
Runs [minio client](https://min.io/docs/minio/linux/reference/minio-mc.html) to upload file(s) to MinIO (self-hosted as well)
## Tricky part
_Technically_ this action can be used with different S3-compatible services, but it **needs tuning**
### MinIO
1. You should have a leading slash at the start of `target`
2. You should include filename/dirname into `target`. If you have `source=./directory` and `target=/subdir/directory`, it would be nested - `/subdir/directory/directory`
### Yandex Cloud
1. For Ya.Cloud you **have to** include filename/dirname into `target`, otherwise you will get an empty `target`. Example: `source=directory; target=/test` leads to empty `/test`, but `source=directory; target=/test/directory` would upload as expected.
## Usage
1. Upload a file
```yaml
- name: Upload to MinIO
uses: yakubique/minio-upload@v1
uses: yakubique/minio-upload@v1.1.3
with:
endpoint: ${{ secrets.MINIO_ENDPOINT }}
access_key: ${{ secrets.MINIO_ACCESS_KEY }}
secret_key: ${{ secrets.MINIO_SECRET_KEY }}
bucket: my_bucket_name
source: ./my-build-1-0-1.tar.gz
source: ./my-build-1-1-0.tar.gz
# Leading slash is required
target: '/builds'
```
2. Upload a directory
```yaml
- name: Upload to MinIO
uses: yakubique/minio-upload@v1
- name: Upload a directory to MinIO
uses: yakubique/minio-upload@v1.1.3
with:
endpoint: ${{ secrets.MINIO_ENDPOINT }}
access_key: ${{ secrets.MINIO_ACCESS_KEY }}
@ -29,7 +41,7 @@ Runs [minio client](https://min.io/docs/minio/linux/reference/minio-mc.html) to
bucket: my_bucket_name
source: ./public
# Leading slash is required
target: '/my-awesome-site/public'
target: '/my-awesome-site'
# If you omit the `recursive` argument, action only copies objects in the top level of the specified directory.
recursive: true
```
@ -37,7 +49,7 @@ Runs [minio client](https://min.io/docs/minio/linux/reference/minio-mc.html) to
3. Upload to the insecure MinIO instance (_http-only_)
```yaml
- name: Upload to MinIO
uses: yakubique/minio-upload@v1
uses: yakubique/minio-upload@v1.1.3
with:
endpoint: ${{ secrets.MINIO_ENDPOINT }}
access_key: ${{ secrets.MINIO_ACCESS_KEY }}

View File

@ -1,4 +1,6 @@
et -euxo pipefail
#!/bin/sh -l
export PATH=$PATH:/minio-binaries/
insecure_option=""
if [[ "$YA_INSECURE" == "true" ]]; then
@ -6,10 +8,9 @@ if [[ "$YA_INSECURE" == "true" ]]; then
fi
recursive_option=""
if [[ "$YA_INSECURE" == "true" ]]; then
if [[ "$YA_RECURSIVE" == "true" ]]; then
recursive_option="--recursive"
fi
mc alias set ${insecure_option:+"$insecure_option"} target "$YA_ENDPOINT" "$YA_ACCESS_KEY" "$YA_SECRET_KEY"
mc ${insecure_option:+"$insecure_option"} cp ${recursive_option:+"$recursive_option"} $1 "target/$2"