Skip to content

Commit b157dcb

Browse files
committed
fix: fix sub-action versions
1 parent 4e0068a commit b157dcb

File tree

3 files changed

+118
-117
lines changed

3 files changed

+118
-117
lines changed

.github/workflows/ci.yml

Lines changed: 52 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,21 @@ jobs:
1919
steps:
2020
- uses: actions/checkout@v3
2121

22+
# We must hack the action call as remote to be able to use the relative paths
2223
- name: Start LocalStack
23-
uses: ./
24+
uses: jenseng/dynamic-uses@v1
2425
with:
25-
image-tag: 'latest'
26-
install-awslocal: 'true'
27-
configuration: DEBUG=1
28-
use-pro: 'true'
26+
uses: LocalStack/setup-localstack@${{ env.action-version }}
27+
with: |-
28+
{
29+
"image-tag": "latest",
30+
"install-awslocal": "true",
31+
"configuration": "DEBUG=1",
32+
"use-pro": "true",
33+
}
2934
env:
3035
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
36+
action-version: ${{ fromJSON(format('["{0}","{1}"]', github.ref_name, github.head_ref))[github.event_name == 'pull_request'] }}
3137

3238
- name: Run Tests against LocalStack
3339
run: |
@@ -43,27 +49,38 @@ jobs:
4349
uses: actions/checkout@v3
4450

4551
- name: Start LocalStack
46-
uses: ./
52+
uses: jenseng/dynamic-uses@v1
4753
with:
48-
image-tag: 'latest'
49-
install-awslocal: 'true'
50-
use-pro: 'true'
54+
uses: LocalStack/setup-localstack@${{ env.action-version }}
55+
with: |-
56+
{
57+
"image-tag": "latest",
58+
"install-awslocal": "true",
59+
"configuration": "DEBUG=1",
60+
"use-pro": "true",
61+
}
5162
env:
5263
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
64+
action-version: ${{ fromJSON(format('["{0}","{1}"]', github.ref_name, github.head_ref))[github.event_name == 'pull_request'] }}
5365

5466
- name: Run AWS commands
5567
run: |
5668
awslocal s3 mb s3://test
5769
awslocal sqs create-queue --queue-name test-queue
5870
5971
- name: Save the Cloud Pod
60-
uses: ./
72+
uses: jenseng/dynamic-uses@v1
6173
with:
62-
state-name: cloud-pods-test
63-
state-action: save
64-
skip-startup: 'true'
74+
uses: LocalStack/setup-localstack@${{ env.action-version }}
75+
with: |-
76+
{
77+
"state-name": "cloud-pods-test",
78+
"state-action": "save",
79+
"skip-startup": "true",
80+
}
6581
env:
6682
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
83+
action-version: ${{ fromJSON(format('["{0}","{1}"]', github.ref_name, github.head_ref))[github.event_name == 'pull_request'] }}
6784

6885
local-state-test:
6986
name: 'Test Local State Action'
@@ -73,25 +90,36 @@ jobs:
7390
uses: actions/checkout@v3
7491

7592
- name: Start LocalStack
76-
uses: ./
93+
uses: jenseng/dynamic-uses@v1
7794
with:
78-
image-tag: 'latest'
79-
install-awslocal: 'true'
80-
use-pro: 'true'
95+
uses: LocalStack/setup-localstack@${{ env.action-version }}
96+
with: |-
97+
{
98+
"image-tag": "latest",
99+
"install-awslocal": "true",
100+
"configuration": "DEBUG=1",
101+
"use-pro": "true",
102+
}
81103
env:
82104
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
105+
action-version: ${{ fromJSON(format('["{0}","{1}"]', github.ref_name, github.head_ref))[github.event_name == 'pull_request'] }}
83106

84107
- name: Run AWS commands
85108
run: |
86109
awslocal s3 mb s3://test
87110
awslocal sqs create-queue --queue-name test-queue
88111
89-
- name: Save the State into Artifact
90-
uses: ./
112+
- name: Save the Cloud Pod
113+
uses: jenseng/dynamic-uses@v1
91114
with:
92-
state-name: state-test
93-
state-action: save
94-
state-backend: local
95-
skip-startup: 'true'
115+
uses: LocalStack/setup-localstack@${{ env.action-version }}
116+
with: |-
117+
{
118+
"state-name": "cloud-pods-test",
119+
"state-action": "save",
120+
"state-backend": "local",
121+
"skip-startup": "true",
122+
}
96123
env:
97-
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
124+
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
125+
action-version: ${{ fromJSON(format('["{0}","{1}"]', github.ref_name, github.head_ref))[github.event_name == 'pull_request'] }}

action.yml

Lines changed: 63 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -72,89 +72,71 @@ inputs:
7272
runs:
7373
using: "composite"
7474
steps:
75-
- name: Install tools
76-
uses: jenseng/dynamic-uses@v1
77-
if: ${{ inputs.skip-startup == 'true' || inputs.state-backend == 'preview' }}
78-
env:
79-
action-version: ${{ fromJSON(format('["{0}","{1}"]', github.ref_name, github.head_ref))[github.event_name == 'pull_request'] }}
80-
with:
81-
uses: LocalStack/setup-localstack/tools@${{ env.action-version }}
82-
with: |-
83-
{
84-
"install-awslocal": "${{ inputs.install-awslocal }}",
85-
}
75+
- run: ls -la /home/runner/work/_actions
76+
shell: bash
8677

87-
- name: Start Localstack
88-
uses: jenseng/dynamic-uses@v1
89-
if: ${{ inputs.skip-startup != 'true' && inputs.state-backend != 'preview' }}
90-
env:
91-
action-version: ${{ fromJSON(format('["{0}","{1}"]', github.ref_name, github.head_ref))[github.event_name == 'pull_request'] }}
92-
with:
93-
# now we can dynamically determine sub-action versions 🥳
94-
uses: LocalStack/setup-localstack/startup@${{ env.action-version }}
95-
# the `with` needs to be converted to a valid json string
96-
# keeping in there install-awslocal for backward compatibility
97-
with: |-
98-
{
99-
"image-tag": "${{ inputs.image-tag }}",
100-
"install-awslocal": "${{ inputs.install-awslocal }}",
101-
"use-pro": "${{ inputs.use-pro }}",
102-
"configuration": "${{ inputs.configuration }}",
103-
"ci-project": "${{ inputs.ci-project }}",
104-
"skip-wait": "${{ inputs.skip-wait }}"
105-
}
78+
- run: ls -la /home/runner/work/_actions/LocalStack/setup-localstack
79+
shell: bash
10680

107-
# Use different artifact from current workflow's by passing the workflow's id as WORKFLOW_ID env variable
108-
- name: Manage state
109-
if: ${{ inputs.state-action == 'save' || inputs.state-action == 'load' }}
110-
uses: jenseng/dynamic-uses@v1
111-
env:
112-
action-version: ${{ fromJSON(format('["{0}","{1}"]', github.ref_name, github.head_ref))[github.event_name == 'pull_request'] }}
113-
with:
114-
uses: LocalStack/setup-localstack/${{ inputs.state-backend }}@${{ env.action-version }}
115-
with: |-
116-
{
117-
"name": "${{ inputs.state-name }}",
118-
"action": "${{ inputs.state-action }}"
119-
}
81+
# - name: Install tools
82+
# uses: jenseng/dynamic-uses@v1
83+
# if: ${{ inputs.skip-startup == 'true' || inputs.state-backend == 'preview' }}
84+
# env:
85+
# action-version: ${{ fromJSON(format('["{0}","{1}"]', github.ref_name, github.head_ref))[github.event_name == 'pull_request'] }}
86+
# with:
87+
# uses: LocalStack/setup-localstack/tools@${{ env.action-version }}
88+
# with: |-
89+
# {
90+
# "install-awslocal": "${{ inputs.install-awslocal }}",
91+
# }
12092

121-
- name: Create Ephemeral Instance
122-
if: ${{ inputs.state-action == 'start' && inputs.state-backend == 'preview' }}
123-
uses: jenseng/dynamic-uses@v1
124-
env:
125-
action-version: ${{ fromJSON(format('["{0}","{1}"]', github.ref_name, github.head_ref))[github.event_name == 'pull_request'] }}
126-
with:
127-
uses: LocalStack/setup-localstack/preview@${{ env.action-version }}
128-
with: |-
129-
{
130-
"github-token": "${{ inputs.github-token }}",
131-
"preview-cmd": "${{ inputs.preview-cmd }}",
132-
"auto-load-pod": "${{ inputs.state-name }}"
133-
}
93+
# - name: Start Localstack
94+
# uses: ./../../_actions/LocalStack/setup-localstack/startup
95+
# if: ${{ inputs.skip-startup != 'true' && inputs.state-backend != 'preview' }}
96+
# with:
97+
# image-tag: ${{ inputs.image-tag }}
98+
# # keeping install-awslocal for backward compatibility
99+
# install-awslocal: ${{ inputs.install-awslocal }}
100+
# use-pro: ${{ inputs.use-pro }}
101+
# configuration: ${{ inputs.configuration }}
102+
# ci-project: ${{ inputs.ci-project }}
103+
# skip-wait: ${{ inputs.skip-wait }}
134104

135-
- name: Display Ephemeral Instance URL
136-
if: ${{ inputs.state-action == 'start' && inputs.state-backend == 'preview' && (inputs.include-preview == 'true' || inputs.ci-project != '') }}
137-
uses: jenseng/dynamic-uses@v1
138-
env:
139-
action-version: ${{ fromJSON(format('["{0}","{1}"]', github.ref_name, github.head_ref))[github.event_name == 'pull_request'] }}
140-
default-include-preview: ${{ fromJSON('["false","true"]')[github.event_name == 'pull_request'] }}
141-
with:
142-
uses: LocalStack/setup-localstack/finish@${{ env.action-version }}
143-
with: |-
144-
{
145-
"github-token": "${{ inputs.github-token }}",
146-
"ci-project": "${{ inputs.ci-project }}",
147-
"include-preview": "${{ fromJSON(format('["{0}","{1}"]', env.include-preview, inputs.include-preview))[inputs.include-preview != ''] }}"
148-
}
105+
# # Use different artifact from current workflow's by passing the workflow's id as WORKFLOW_ID env variable
106+
# - name: Manage state
107+
# if: ${{ inputs.state-action == 'save' || inputs.state-action == 'load' }}
108+
# uses: jenseng/dynamic-uses@v1
109+
# with:
110+
# # now we can dynamically determine sub-actions 🥳
111+
# uses: ./../../_actions/LocalStack/setup-localstack/${{ inputs.state-backend }}
112+
# # the `with` needs to be converted to a valid json string
113+
# with: |-
114+
# {
115+
# "name": "${{ inputs.state-name }}",
116+
# "action": "${{ inputs.state-action }}"
117+
# }
118+
119+
# - name: Create Ephemeral Instance
120+
# if: ${{ inputs.state-action == 'start' && inputs.state-backend == 'preview' }}
121+
# uses: ./../../_actions/LocalStack/setup-localstack/preview
122+
# with:
123+
# github-token: ${{ inputs.github-token }}
124+
# preview-cmd: ${{ inputs.preview-cmd }}
125+
# auto-load-pod: ${{ inputs.state-name }}
126+
127+
# - name: Display Ephemeral Instance URL
128+
# if: ${{ inputs.state-action == 'start' && inputs.state-backend == 'preview' && (inputs.include-preview == 'true' || inputs.ci-project != '') }}
129+
# env:
130+
# default-include-preview: ${{ fromJSON('["false","true"]')[github.event_name == 'pull_request'] }}
131+
# uses: ./../../_actions/LocalStack/setup-localstack/finish
132+
# with:
133+
# github-token: ${{ inputs.github-token }}
134+
# ci-project: ${{ inputs.ci-project }}
135+
# include-preview: ${{ fromJSON(format('["{0}","{1}"]', env.include-preview, inputs.include-preview))[inputs.include-preview != ''] }}
136+
149137

150-
- name: Stop Ephemeral Instance
151-
if: ${{ !inputs.skip-preview-stop && inputs.state-action == 'stop' && inputs.state-backend == 'preview' }}
152-
uses: jenseng/dynamic-uses@v1
153-
env:
154-
action-version: ${{ fromJSON(format('["{0}","{1}"]', github.ref_name, github.head_ref))[github.event_name == 'pull_request'] }}
155-
with:
156-
uses: LocalStack/setup-localstack/ephemeral/shutdown@${{ env.action-version }}
157-
with: |-
158-
{
159-
"name": "${{ inputs.github-token }}",
160-
}
138+
# - name: Stop Ephemeral Instance
139+
# if: ${{ !inputs.skip-preview-stop && inputs.state-action == 'stop' && inputs.state-backend == 'preview' }}
140+
# uses: ./../../_actions/LocalStack/setup-localstack/ephemeral/shutdown
141+
# with:
142+
# name: ${{ inputs.github-token }}

startup/action.yml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,9 @@ runs:
3939
# ci-project: ${{ inputs.ci-project }}
4040

4141
- name: Install tools
42-
uses: jenseng/dynamic-uses@v1
43-
env:
44-
action-version: ${{ fromJSON(format('["{0}","{1}"]', github.ref_name, github.head_ref))[github.event_name == 'pull_request'] }}
45-
with:
46-
# now we can dynamically determine sub-action versions 🥳
47-
uses: LocalStack/setup-localstack/tools@${{ env.action-version }}
48-
# the `with` needs to be converted to a valid json string
49-
# keeping in there install-awslocal for backward compatibility
50-
with: |-
51-
{
52-
"install-awslocal": "${{ inputs.install-awslocal }}",
53-
}
42+
uses: ./../../_actions/LocalStack/setup-localstack/tools
43+
with:
44+
install-awslocal: ${{ inputs.install-awslocal }}
5445

5546
- name: Start LocalStack
5647
run: |

0 commit comments

Comments
 (0)