Skip to content

Commit c7e05f3

Browse files
committed
Use cache for mc binary
Signed-off-by: Kostis Papazafeiropoulos <[email protected]>
1 parent 63df409 commit c7e05f3

File tree

2 files changed

+34
-4
lines changed

2 files changed

+34
-4
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
access-key: ${{ secrets.AWS_ACCESS_KEY }}
2323
secret-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
2424
local-path: "./files/test1.txt"
25-
remote-path: "github/minio/"
25+
remote-path: "nbfc-assets/github/minio/"
2626

2727
- name: Test wildcard with extension upload
2828
uses: ./
@@ -31,7 +31,7 @@ jobs:
3131
access-key: ${{ secrets.AWS_ACCESS_KEY }}
3232
secret-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
3333
local-path: "./files/*.txt"
34-
remote-path: "github/minio/"
34+
remote-path: "nbfc-assets/github/minio/"
3535

3636
- name: Test wildcard upload
3737
uses: ./
@@ -40,4 +40,4 @@ jobs:
4040
access-key: ${{ secrets.AWS_ACCESS_KEY }}
4141
secret-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
4242
local-path: "./files/*"
43-
remote-path: "github/minio/"
43+
remote-path: "nbfc-assets/github/minio/"

action.yml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,40 @@ inputs:
2626
runs:
2727
using: composite
2828
steps:
29+
- name: Check if mc is installed
30+
id: check-mc
31+
run: |
32+
if [[ -n "$(which mc)" ]]; then
33+
echo "exists=true" >> "$GITHUB_OUTPUT"
34+
else
35+
echo "exists=false" >> "$GITHUB_OUTPUT"
36+
fi
37+
shell: bash
38+
39+
- name: Download latest mc SHA256
40+
id: mc-sha
41+
if: ${{ steps.check-mc.outputs.exists == 'false' }}
42+
run: |
43+
sha=$(wget -qO- \
44+
https://dl.min.io/client/mc/release/linux-amd64/mc.sha256sum \
45+
| awk '{print $1}')
46+
echo "sha256=$sha" >> "$GITHUB_OUTPUT"
47+
shell: bash
48+
49+
- name: Cache mc binary
50+
id: cache-mc
51+
if: ${{ steps.check-mc.outputs.exists == 'false' }}
52+
uses: actions/cache@v4
53+
with:
54+
path: /usr/local/bin/mc
55+
key: mc-${{ steps.mc-sha.outputs.sha256 }}
56+
2957
- name: Setup mc
3058
working-directory: /usr/local/bin
59+
if: >-
60+
${{ steps.check-mc.outputs.exists == 'false'
61+
&& steps.cache-mc.outputs.cache-hit != 'true' }}
3162
run: |
32-
[ -n "$(which mc)" ] && exit 0
3363
arch=$(dpkg --print-architecture | sed 's/armhf/arm/g')
3464
sudo wget --progres=dot:binary \
3565
"https://dl.min.io/client/mc/release/linux-${arch}/mc"

0 commit comments

Comments
 (0)