Skip to content
This repository has been archived by the owner on Nov 29, 2024. It is now read-only.

Commit

Permalink
feat: move target ref logic to tags action
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandoataoldotcom authored Nov 3, 2023
1 parent a8af7b6 commit 147508a
Showing 1 changed file with 8 additions and 20 deletions.
28 changes: 8 additions & 20 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,29 +150,10 @@ runs:
;;
esac
- name: Determine ref
id: determine_ref
shell: bash
run: |
echo "::group::determine ref"
if [[ $GITHUB_REF == refs/heads/* ]]; then
echo "REF_TYPE=branch" >> $GITHUB_ENV
echo "TARGET_REF=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
elif [[ $GITHUB_REF == refs/tags/* ]]; then
echo "REF_TYPE=tag" >> $GITHUB_ENV
echo "TARGET_REF=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
elif [[ $GITHUB_REF == refs/pull/* ]]; then
echo "REF_TYPE=pull_request" >> $GITHUB_ENV
echo "TARGET_REF=$GITHUB_SHA" >> $GITHUB_ENV
else
echo "REF_TYPE=unknown" >> $GITHUB_ENV
fi
echo "::endgroup::"
- name: Checkout
uses: actions/checkout@v3
with:
ref: '' # implement specific ref when above is used
ref: '' # future use-case for immutability
path: ${{ inputs.target_directory }}

- name: Create GlueOps Tags
Expand All @@ -197,6 +178,12 @@ runs:
TAGS="${{ steps.create-tags.outputs.tags_csv }}"
fi
# Get Target Ref
TARGET_REF="${{ steps.create-tags.outputs.clean_target_ref}}"
if [[ -z "$TARGET_REF" ]]; then
TARGET_REF="${TAGS%%,*}"
fi
echo "Using Tags: ${TAGS}"
# convert the image name to lowercase
Expand Down Expand Up @@ -235,6 +222,7 @@ runs:
echo "::group::Inspecting the image ..."
docker image ls
echo "Labels:"
docker image inspect "${{ inputs.registry }}/${IMAGE_NAME}:${TARGET_REF}" | jq '.[].Config.Labels'
Expand Down

0 comments on commit 147508a

Please sign in to comment.