OpenWRT/.github/workflows/upload-file-s3.yml
Christian Marangi ebbc806d30
CI: add support for getting ccache cache from S3
Add support for getting ccache cache from S3.
ccache is archieved in a tar and downloaded from S3 Cloud Storage.

For push events, ccache is then uplodaed back to S3 to refresh and have
a ccache cache always fresh.

An additional workflow is added to upload files to an S3 Cloud Storage
from artifacts uplodaed to github. The minio tool is used to upload
files to S3.

If the ccache can't be downloaded from s3, we fallback to github cache
system.

Also limit s3 upload to the openwrt repository since external fork won't
have (obviously) the required secrtes to upload data to the S3 Cloud
Storage.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2023-05-31 13:22:05 +02:00

47 lines
1.1 KiB
YAML

name: Upload File to S3
on:
workflow_call:
secrets:
s3_access_key:
s3_secret_key:
inputs:
endpoint:
required: true
type: string
bucket:
required: true
type: string
download_id:
required: true
type: string
filename:
required: true
type: string
jobs:
upload-file-in-s3:
name: Upload file in S3
runs-on: ubuntu-latest
steps:
- name: Install minio
run: |
curl https://dl.min.io/client/mc/release/linux-amd64/mc \
--create-dirs \
-o $GITHUB_WORKSPACE/minio-binaries/mc
chmod +x $GITHUB_WORKSPACE/minio-binaries/mc
echo $GITHUB_WORKSPACE/minio-binaries/ >> $GITHUB_PATH
- name: Setup minio
run: mc alias set s3 ${{ inputs.endpoint }} ${{ secrets.s3_access_key }} ${{ secrets.s3_secret_key }}
- name: Download file
uses: actions/download-artifact@v3
with:
name: ${{ inputs.download_id }}
- name: Upload file to s3
run: mc cp ${{ inputs.filename }} s3/${{ inputs.bucket }}/