diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 60fb79b..5ebfc93 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,7 +16,7 @@ jobs: access-key: ${{ secrets.AWS_ACCESS_KEY }} secret-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} local-path: "./" - remote-path: "github/minio/test1.txt" + remote-path: "nbfc-assets/github/minio/test1.txt" - name: Test wildcard with extension download uses: ./ @@ -25,7 +25,7 @@ jobs: access-key: ${{ secrets.AWS_ACCESS_KEY }} secret-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} local-path: "./" - remote-path: "github/minio/*.txt" + remote-path: "nbfc-assets/github/minio/*.txt" - name: Test wildcard download uses: ./ @@ -34,4 +34,4 @@ jobs: access-key: ${{ secrets.AWS_ACCESS_KEY }} secret-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} local-path: "./" - remote-path: "github/minio/*" + remote-path: "nbfc-assets/github/minio/*" diff --git a/action.yml b/action.yml index 7777441..2782e48 100644 --- a/action.yml +++ b/action.yml @@ -23,10 +23,40 @@ inputs: runs: using: composite steps: + - name: Check if mc is installed + id: check-mc + run: | + if [[ -n "$(which mc)" ]]; then + echo "exists=true" >> "$GITHUB_OUTPUT" + else + echo "exists=false" >> "$GITHUB_OUTPUT" + fi + shell: bash + + - name: Download latest mc SHA256 + id: mc-sha + if: ${{ steps.check-mc.outputs.exists == 'false' }} + run: | + sha=$(wget -qO- \ + https://dl.min.io/client/mc/release/linux-amd64/mc.sha256sum \ + | awk '{print $1}') + echo "sha256=$sha" >> "$GITHUB_OUTPUT" + shell: bash + + - name: Cache mc binary + id: cache-mc + if: ${{ steps.check-mc.outputs.exists == 'false' }} + uses: actions/cache@v4 + with: + path: /usr/local/bin/mc + key: mc-${{ steps.mc-sha.outputs.sha256 }} + - name: Setup mc working-directory: /usr/local/bin + if: >- + ${{ steps.check-mc.outputs.exists == 'false' + && steps.cache-mc.outputs.cache-hit != 'true' }} run: | - [ -n "$(which mc)" ] && exit 0 arch=$(dpkg --print-architecture | sed 's/armhf/arm/g') sudo wget --progres=dot:binary \ "https://dl.min.io/client/mc/release/linux-${arch}/mc"