remove header from curl request, switch to using temporary tag file.

This commit is contained in:
brooke 2025-06-18 16:30:30 -04:00
parent a7edd7f9b1
commit 847da8c4d5

View file

@ -29,16 +29,39 @@ jobs:
- name: Get tags from GitLab repository - name: Get tags from GitLab repository
id: get_tags id: get_tags
run: | run: |
TAGS=$(curl --header "PRIVATE-TOKEN: ${{ secrets.GITLAB_ACCESS_TOKEN }}" "https://gitlab.com/api/v4/projects/liberaforms%2Fliberaforms/repository/tags" | jq -r '.[].name') TAGS=$(curl "https://gitlab.com/api/v4/projects/liberaforms%2Fliberaforms/repository/tags" | jq -r '.[].name')
echo "tags=$TAGS" >> $GITHUB_OUTPUT echo "All available tags:"
echo "$TAGS"
echo "$TAGS" > /tmp/all_tags.txt
- name: Filter out RC and dev tags and get the latest version - name: Filter out RC and dev tags and get the latest version
id: filter_tags id: filter_tags
run: | run: |
TAGS="${{ steps.get_tags.outputs.tags }}" if [ -f "/tmp/all_tags.txt" ]; then
FILTERED_TAGS=$(echo "$TAGS" | grep -Ev 'RC[0-9]$|dev' | sort -V | tail -n 1) TAGS=$(cat /tmp/all_tags.txt)
echo "Latest tag excluding RC and dev: $FILTERED_TAGS" echo "All tags before filtering:"
echo "latest_tag=$FILTERED_TAGS" >> $GITHUB_OUTPUT echo "$TAGS"
# Use simple grep commands separately to ensure proper filtering
# Retain only tags that don't contain "-dev" and don't contain "-RC"
FILTERED_TAGS=$(echo "$TAGS" | grep -v "\-dev" | grep -v "\-RC")
echo "Tags after filtering:"
echo "$FILTERED_TAGS"
if [ -z "$FILTERED_TAGS" ]; then
echo "No tags matched the filter criteria"
echo "latest_tag=" >> $GITHUB_OUTPUT
else
# Sort versions and get the latest
LATEST_TAG=$(echo "$FILTERED_TAGS" | sort -V | tail -n 1)
echo "Latest tag excluding RC and dev: $LATEST_TAG"
echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT
fi
else
echo "Error: Tag file not found"
echo "latest_tag=" >> $GITHUB_OUTPUT
fi
- name: Build and Push with Latest Tag - name: Build and Push with Latest Tag
uses: docker/build-push-action@v4 uses: docker/build-push-action@v4