Skip to content

Commit

Permalink
chore: adds earthly provider support
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgilman committed Aug 30, 2024
1 parent b0b0b16 commit 5a3891b
Showing 1 changed file with 37 additions and 3 deletions.
40 changes: 37 additions & 3 deletions forge/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ runs:
echo "role=$ROLE" >> $GITHUB_OUTPUT
- name: Configure AWS
uses: aws-actions/configure-aws-credentials@v4
if: ${{ steps.aws.outputs.region != '' && steps.aws.outputs.role != '' }}
if: steps.aws.outputs.region != '' && steps.aws.outputs.role != ''
with:
aws-region: ${{ steps.aws.outputs.region }}
role-to-assume: ${{ steps.aws.outputs.role }}
Expand All @@ -73,11 +73,45 @@ runs:
fi
fi
echo "::add-mask::$USERNAME"
echo "::add-mask::$PASSWORD"
echo "username=$USERNAME" >> $GITHUB_OUTPUT
echo "password=$PASSWORD" >> $GITHUB_OUTPUT
- name: Login to Docker Hub
uses: docker/login-action@v3
if: ${{ steps.docker.outputs.username != '' && steps.docker.outputs.password != '' }}
if: steps.docker.outputs.username != '' && steps.docker.outputs.password != ''
with:
username: ${{ steps.docker.outputs.username }}
password: ${{ steps.docker.outputs.password }}
password: ${{ steps.docker.outputs.password }}

# Earthly Provider
- name: Install Earthly
uses: earthly/actions-setup@v1
if: inputs.forge_version != 'local'
with:
version: ${{ inputs.earthly_version }}
- name: Get Earthly provider configuration
id: earthly
shell: bash
run: |
BP=$(forge blueprint dump .)
EARTHLY=$(echo "$BP" | jq -r .ci.providers.earthly.credentials)
if [[ "$EARTHLY" != "null" ]]; then
SECRET=$(forge secret get -b . ci.providers.earthly.credentials)
TOKEN=$(echo "$EARTHLY" | jq -r .token)
if [[ "$TOKEN" == "null" ]]; then
echo "Error: the earthly provider secret must map the secret value to 'token'"
exit 1
fi
fi
echo "::add-mask::$TOKEN"
echo "token=$TOKEN" >> $GITHUB_OUTPUT
- name: Login to Earthly Cloud
if: steps.earthly.outputs.token != ''
shell: bash
run: |
earthly account login --token "${{ steps.earthly.outputs.token }}"

0 comments on commit 5a3891b

Please sign in to comment.