Skip to content

Commit

Permalink
feat(tools): add action to install tools
Browse files Browse the repository at this point in the history
  • Loading branch information
lakkeger committed May 15, 2024
1 parent 3a6cd68 commit 13e0c9a
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 7 deletions.
13 changes: 13 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@ inputs:
runs:
using: "composite"
steps:
- name: Install tools
uses: jenseng/dynamic-uses@v1
if: ${{ inputs.skip-startup == 'true' }}
env:
action-version: ${{ fromJSON(format('["{0}","{1}"]', github.ref_name, github.head_ref))[github.event_name == 'pull_request'] }}
with:
uses: LocalStack/setup-localstack/tools@${{ env.action-version }}
with: |-
{
"install-awslocal": "${{ inputs.install-awslocal }}",
}
- name: Start Localstack
uses: jenseng/dynamic-uses@v1
if: ${{ inputs.skip-startup != 'true' }}
Expand All @@ -75,6 +87,7 @@ runs:
# now we can dynamically determine sub-action versions 🥳
uses: LocalStack/setup-localstack/startup@${{ env.action-version }}
# the `with` needs to be converted to a valid json string
# keeping in there install-awslocal for backward compatibility
with: |-
{
"image-tag": "${{ inputs.image-tag }}",
Expand Down
21 changes: 14 additions & 7 deletions startup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,22 @@ runs:
# github-token: ${{ inputs.github-token }}
# ci-project: ${{ inputs.ci-project }}

- name: Install tools
uses: jenseng/dynamic-uses@v1
env:
action-version: ${{ fromJSON(format('["{0}","{1}"]', github.ref_name, github.head_ref))[github.event_name == 'pull_request'] }}
with:
# now we can dynamically determine sub-action versions 🥳
uses: LocalStack/setup-localstack/tools@${{ env.action-version }}
# the `with` needs to be converted to a valid json string
# keeping in there install-awslocal for backward compatibility
with: |-
{
"install-awslocal": "${{ inputs.install-awslocal }}",
}
- name: Start LocalStack
run: |
pip install pyopenssl -U
if [ "$USE_PRO" = true ]; then
if [ "x$LOCALSTACK_AUTH_TOKEN" = "x" || "x$LOCALSTACK_API_KEY" = "x" ]; then
echo "WARNING: LocalStack API key not detected, please verify your configuration..."
Expand All @@ -52,11 +64,6 @@ runs:
docker pull localstack/localstack:"$IMAGE_TAG" &
fi
pip install localstack
if [ "$INSTALL_AWSLOCAL" = true ]; then
pip install awscli-local[ver1]
fi
export CI_PROJECT=${{ inputs.ci-project }}
eval "${CONFIGURATION} localstack start -d"
Expand Down
24 changes: 24 additions & 0 deletions tools/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: 'Install Localstack tools'

inputs:
install-awslocal:
description: 'Whether to install the `awslocal` CLI into the environment'
required: true
default: 'true'

runs:
using: "composite"
steps:
- name: Start LocalStack
run: |
pip install pyopenssl -U
pip install localstack
if [ "$INSTALL_AWSLOCAL" = true ]; then
pip install awscli-local[ver1]
fi
shell: bash
env:
INSTALL_AWSLOCAL: "${{ inputs.install-awslocal }}"

0 comments on commit 13e0c9a

Please sign in to comment.