-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathaction.yaml
89 lines (87 loc) · 3.53 KB
/
action.yaml
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: 'Cache'
description: 'Cache artifacts like dependencies and build outputs to to gcs or azure to improve workflow execution time'
author: 'kopax-polyconseil'
inputs:
path:
description: 'A list of files, directories, and wildcard patterns to cache and restore'
required: true
key:
description: 'An explicit key for restoring and saving the cache'
required: true
restore-keys:
description: 'An ordered list of keys to use for restoring stale cache if no cache hit occurred for key. Note `cache-hit` returns false in this case.'
required: false
upload-chunk-size:
description: 'The chunk size used to split up large files during upload, in bytes'
required: false
enableCrossOsArchive:
description: 'An optional boolean when enabled, allows windows runners to save or restore caches that can be restored or saved respectively on other platforms'
default: 'false'
required: false
fail-on-cache-miss:
description: 'Fail the workflow if cache entry is not found'
default: 'false'
required: false
lookup-only:
description: 'Check if a cache entry exists for the given input(s) (key, restore-keys) without downloading the cache'
default: 'false'
required: false
bucket:
description: 'Name of the bucket to store the cache into'
required: false
compression-method:
description: 'Compression method for the archive (gzip or zstd)'
default: ''
required: false
workload-identity-provider:
description: 'GCP workload identity provider'
required: false
service-account:
description: 'GCP service-account'
required: false
key-file-name:
description: 'GCS auth key file path (required for gcs if not providing the service-account and workload-identity-provider)'
required: false
outputs:
cache-hit:
description: 'A boolean value to indicate an exact match was found for the primary key'
runs:
using: "composite"
steps:
- name: Cache github
if: ${{ startsWith(runner.name, 'GitHub Actions') }}
id: cache-github
uses: actions/cache@v3
with:
path: ${{ inputs.path }}
key: ${{ inputs.key }}
restore-keys: ${{ inputs.restore-keys }}
upload-chunk-size: ${{ inputs.upload-chunk-size }}
enableCrossOsArchive: ${{ inputs.enableCrossOsArchive }}
fail-on-cache-miss: ${{ inputs.fail-on-cache-miss }}
lookup-only: ${{ inputs.lookup-only }}
- name: "OpenID Connect Authentication"
id: openid-connect-auth
if: ${{ ! startsWith(runner.name, 'GitHub Actions') && inputs.service-account && inputs.workload-identity-provider }}
uses: 'google-github-actions/auth@v1'
with:
cleanup_credentials: false
workload_identity_provider: ${{ inputs.workload-identity-provider }}
service_account: ${{ inputs.service-account }}
- name: 'Set up Cloud SDK'
if: ${{ ! startsWith(runner.name, 'GitHub Actions') && inputs.service-account && inputs.workload-identity-provider }}
uses: 'google-github-actions/setup-gcloud@v1'
- name: Cache gcs
if: ${{ ! startsWith(runner.name, 'GitHub Actions') }}
id: gcs-cache
uses: kopax-polyconseil/[email protected]
with:
path: ${{ inputs.path }}
key: ${{ inputs.key }}
restore-keys: ${{ inputs.restore-keys }}
bucket: ${{ inputs.bucket }}
compression-method: ${{ inputs.compression-method }}
key-file-name: ${{ steps.openid-connect-auth.outputs.credentials_file_path || inputs.key-file-name }}
branding:
icon: 'archive'
color: 'gray-dark'