Skip to content

Commit 5a3891b

Browse files
committed
chore: adds earthly provider support
1 parent b0b0b16 commit 5a3891b

File tree

1 file changed

+37
-3
lines changed

1 file changed

+37
-3
lines changed

forge/actions/setup/action.yml

+37-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ runs:
4949
echo "role=$ROLE" >> $GITHUB_OUTPUT
5050
- name: Configure AWS
5151
uses: aws-actions/configure-aws-credentials@v4
52-
if: ${{ steps.aws.outputs.region != '' && steps.aws.outputs.role != '' }}
52+
if: steps.aws.outputs.region != '' && steps.aws.outputs.role != ''
5353
with:
5454
aws-region: ${{ steps.aws.outputs.region }}
5555
role-to-assume: ${{ steps.aws.outputs.role }}
@@ -73,11 +73,45 @@ runs:
7373
fi
7474
fi
7575
76+
echo "::add-mask::$USERNAME"
77+
echo "::add-mask::$PASSWORD"
78+
7679
echo "username=$USERNAME" >> $GITHUB_OUTPUT
7780
echo "password=$PASSWORD" >> $GITHUB_OUTPUT
7881
- name: Login to Docker Hub
7982
uses: docker/login-action@v3
80-
if: ${{ steps.docker.outputs.username != '' && steps.docker.outputs.password != '' }}
83+
if: steps.docker.outputs.username != '' && steps.docker.outputs.password != ''
8184
with:
8285
username: ${{ steps.docker.outputs.username }}
83-
password: ${{ steps.docker.outputs.password }}
86+
password: ${{ steps.docker.outputs.password }}
87+
88+
# Earthly Provider
89+
- name: Install Earthly
90+
uses: earthly/actions-setup@v1
91+
if: inputs.forge_version != 'local'
92+
with:
93+
version: ${{ inputs.earthly_version }}
94+
- name: Get Earthly provider configuration
95+
id: earthly
96+
shell: bash
97+
run: |
98+
BP=$(forge blueprint dump .)
99+
100+
EARTHLY=$(echo "$BP" | jq -r .ci.providers.earthly.credentials)
101+
if [[ "$EARTHLY" != "null" ]]; then
102+
SECRET=$(forge secret get -b . ci.providers.earthly.credentials)
103+
TOKEN=$(echo "$EARTHLY" | jq -r .token)
104+
105+
if [[ "$TOKEN" == "null" ]]; then
106+
echo "Error: the earthly provider secret must map the secret value to 'token'"
107+
exit 1
108+
fi
109+
fi
110+
111+
echo "::add-mask::$TOKEN"
112+
echo "token=$TOKEN" >> $GITHUB_OUTPUT
113+
- name: Login to Earthly Cloud
114+
if: steps.earthly.outputs.token != ''
115+
shell: bash
116+
run: |
117+
earthly account login --token "${{ steps.earthly.outputs.token }}"

0 commit comments

Comments
 (0)