diff --git a/forge/actions/setup/action.yml b/forge/actions/setup/action.yml index 09c2da61..7de4cd62 100644 --- a/forge/actions/setup/action.yml +++ b/forge/actions/setup/action.yml @@ -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 }} @@ -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 }} \ No newline at end of file + 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 }}" \ No newline at end of file