villebro commented on a change in pull request #11148:
URL:
https://github.com/apache/incubator-superset/pull/11148#discussion_r503072144
##########
File path: .github/workflows/latest-release-tag.yml
##########
@@ -0,0 +1,95 @@
+name: Latest tag
+on:
+ release:
+ types: [published] # This makes it run only when a new released is
published
+
+jobs:
+ latest-release:
+ name: Add/update tag to new release
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v2
+
+ - name: Check for latest tag
+ id: latest-tag
+ run: |
+ LATEST_TAG=$(git show-ref --tags -d | grep latest^{} | sed
's/refs\/tags\/latest^{}//') || echo 'not found'
Review comment:
It took me some time to figure out what `^{}` means in this context (I
thought it was some non-standard regex in grep 😆 ). Perhaps we could add a
comment here explaining what we're greping and seding.
##########
File path: .github/workflows/latest-release-tag.yml
##########
@@ -0,0 +1,95 @@
+name: Latest tag
+on:
+ release:
+ types: [published] # This makes it run only when a new released is
published
+
+jobs:
+ latest-release:
+ name: Add/update tag to new release
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v2
+
+ - name: Check for latest tag
+ id: latest-tag
+ run: |
+ LATEST_TAG=$(git show-ref --tags -d | grep latest^{} | sed
's/refs\/tags\/latest^{}//') || echo 'not found'
+
+ # if 'latest' tag doesn't exist, then set this commit to latest
+ if [[ -z "$LATEST_TAG" ]]
+ then
+ # move on to next task
+ echo "there are no latest tags yet, so I'm going to start by tagging
this sha as the latest"
+ exit 0
+ fi
+
+ TAGS=$(git show-ref --tags -d | grep $LATEST_TAG)
+
+ ## get all tags that use the same sha as the latest tag
+ IFS=$'\n'
+ LATEST_TAGS=($TAGS)
+
+ ## loop over those tags and only take action on the one that isn't
tagged 'latest'
+ ## that one will have the version number tag
+ for (( i=0; i<${#LATEST_TAGS[@]}; i++ ))
+ do
+ if [[ ${LATEST_TAGS[$i]} != *"latest"* ]]
+ then
+ ## extract just the version from this tag
+ LATEST_RC_TAG=$(echo "${LATEST_TAGS[$i]}" | sed -e 's,.*
refs/tags/,,' -e 's/rc//')
+ echo "The current release with the latest tag is version
${LATEST_RC_TAG}"
+
+ ## remove the sha from the latest tag and split into an array-
split at the dot
+ IFS=$'.'
+ LATEST_RC_TAG_SPLIT=(${LATEST_RC_TAG})
+
+ ## remove the 'rc' from the current tag if it exists and split
into an array at the dot
+ THIS_TAG=($(echo ${{ github.event.release.tag_name }} | sed
's/rc//')) || echo 'not found'
Review comment:
We probably don't want to consider release candidates for `latest`?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]