Skip to content

Commit

Permalink
Add command action (#389)
Browse files Browse the repository at this point in the history
  • Loading branch information
sds authored Oct 21, 2024
1 parent 7139a09 commit 3fadbf5
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/actions/command/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Hub command
description: Run a command (deploy, plan, etc.) for a particular hub

inputs:
aws-access-key-id:
required: true
aws-secret-access-key:
required: true
ssh-private-key:
required: true
dockerhub-username:
required: true
dockerhub-password:
required: true
command:
required: true
healthcheck:
required: false

runs:
using: composite

steps:
# Allow pushing images to ECR
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ inputs.aws-access-key-id }}
mask-aws-account-id: no
aws-secret-access-key: ${{ inputs.aws-secret-access-key }}
aws-region: 'us-east-1'
- name: Login to AWS ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

# For pulling images from Docker Hub without hitting rate limits
- run: docker login --username ${{ inputs.dockerhub-username }} --password ${{ inputs.dockerhub-password }}
shell: bash

- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ inputs.ssh-private-key }}

- run: ${{ inputs.command }}
shell: bash
env:
EARTHLY_SECRETS: "AWS_ACCESS_KEY_ID=${{ inputs.aws-access-key-id }},AWS_SECRET_ACCESS_KEY=${{ inputs.aws-secret-access-key }}"
EARTHLY_VERBOSE: true

- if: ${{ inputs.healthcheck }}
name: Check health
uses: nick-fields/retry@v3
with:
max_attempts: 30
timeout_minutes: 2
shell: bash
command: ${{ inputs.healthcheck }}
warning_on_retry: false

0 comments on commit 3fadbf5

Please sign in to comment.