-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathaction.yml
More file actions
56 lines (51 loc) · 1.86 KB
/
action.yml
File metadata and controls
56 lines (51 loc) · 1.86 KB
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
name: 'Save/Load LocalStack state'
description: 'Save or load LocalStack state'
inputs:
name:
description: 'Name of the artifact'
required: true
default: 'ls-state'
action:
description: 'Action to perform (save or load)'
required: true
default: 'save'
runs:
using: "composite"
steps:
# Try to get pr artifact from current workflow
- name: Download current workflow's Local State artifact
id: get-state-artifact
if: ${{ inputs.action == 'load' }}
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 #v7
continue-on-error: true
with:
name: ${{ inputs.name }}
# If the above fails, try to get the latest artifact from given workflow
- name: Download latest Local State artifact
uses: dawidd6/action-download-artifact@0bd50d53a6d7fb5cb921e607957e9cc12b4ce392 #v12
if: ${{ inputs.action == 'load' && steps.get-state-artifact.outcome == 'failure' }}
with:
name: ${{ inputs.name }}
workflow: ${{ env.LS_STATE_ARTIFACT_WORKFLOW }} # Can be ID or workflow file name, if empty falls back to the latest successful run of the current workflow
if_no_artifact_found: warn
- run: |
if [ "$ACTION" = "save" ]; then
echo "Saving State $NAME"
localstack state export ${NAME}.zip
elif [ "$ACTION" = "load" ]; then
echo "Loading State $NAME"
localstack state import ${NAME}.zip
else
echo "Invalid action: $ACTION"
exit 1
fi
shell: bash
env:
NAME: "${{ inputs.name }}"
ACTION: "${{ inputs.action }}"
- name: Upload LocalStack State
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
if: ${{ inputs.action == 'save' }}
with:
name: ${{ inputs.name }}
path: ./${{ inputs.name }}.zip