-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.yml
69 lines (62 loc) · 2.28 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Setup Restic
description: Setup/Install Restic for GitHub Actions
branding:
icon: life-buoy
color: yellow
inputs:
version:
description: Restic version
default: latest
token:
description: GitHub token to avoid API rate limiting
default: ${{ github.token }}
runs:
using: composite
steps:
- name: Get Restic version for Unix-like
id: version-unix-like
if: runner.os == 'Linux' || runner.os == 'macOS'
shell: bash
run: $GITHUB_ACTION_PATH/scripts/version/Unix-like.sh
env:
version: ${{ inputs.version }}
GITHUB_TOKEN: ${{ inputs.token }}
- name: Get Restic version for Windows
id: version-windows
if: runner.os == 'Windows'
shell: pwsh
run: '& $env:GITHUB_ACTION_PATH\scripts\version\Windows.ps1'
env:
version: ${{ inputs.version }}
GITHUB_TOKEN: ${{ inputs.token }}
- name: Restore Restic cache
id: cache
uses: actions/cache/restore@v4
with:
path: ${{ runner.tool_cache }}/Restic
key: Restic-${{ steps.version-unix-like.outputs.version || steps.version-windows.outputs.version }}-${{ runner.os }}
- name: Download Restic for Unix-like
if: (runner.os == 'Linux' || runner.os == 'macOS') && ! steps.cache.outputs.cache-hit
shell: bash
working-directory: ${{ runner.temp }}
run: $GITHUB_ACTION_PATH/scripts/download/Unix-like.sh
env:
version: ${{ steps.version-unix-like.outputs.version }}
- name: Download Restic for Windows
if: runner.os == 'Windows' && ! steps.cache.outputs.cache-hit
shell: pwsh
working-directory: ${{ runner.temp }}
run: '& $env:GITHUB_ACTION_PATH\scripts\download\Windows.ps1'
env:
version: ${{ steps.version-windows.outputs.version }}
- name: Install Restic on tool cache
uses: AnimMouse/tool-cache@v1
with:
folder_name: Restic
cache_hit: ${{ steps.cache.outputs.cache-hit }}
- name: Save Restic cache
if: '! steps.cache.outputs.cache-hit'
uses: actions/cache/save@v4
with:
path: ${{ runner.tool_cache }}/Restic
key: Restic-${{ steps.version-unix-like.outputs.version || steps.version-windows.outputs.version }}-${{ runner.os }}