-
-
Notifications
You must be signed in to change notification settings - Fork 385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Make latest tag point to latest release and not a dev build #556
Comments
Hey nice suggestion. Although, this is going to sound totally selfish... but I CRAVE user feedback! There are so many aspects/features and different vpn providers, I can't (even with more tests) possibly ensure by myself that everything works. I also doubt anyone would use the :dev image really. I'm doing my best making sure So far, I use
So, yes the user run experimental code, but that feels to me like a critical piece to have fast development and stable releases. On the other hand, I could have another tag like |
The idea of the |
Would a I'll also try to do e. g. |
All of that would be good, I actually like the |
You seem to be doing it through custom code in your action, so you'll probably just tweak that, but the below usage of docker/metadata-action handles it pretty well for me.
Below is easily tweaked to give - name: Check for semver tag
id: semvercheck
run: |
if [[ ${{ github.ref }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
MATCH=true
else
MATCH=false
fi
if [[ ! ${{ github.ref }} =~ ^refs/tags/v0\. ]]; then
MATCH=$MATCH_nonzero
fi
echo ::set-output name=match::$MATCH
# extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v3
with:
flavor: |
latest=false
images: |
${{ env.IMAGE_NAME }}
${{ env.GHCR }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=ref,event=tag,enable=${{ !startsWith(steps.semvercheck.outputs.match, 'true') }}
type=semver,pattern={{version}},enable=${{ startsWith(steps.semvercheck.outputs.match, 'true') }}
type=semver,pattern={{major}}.{{minor}},enable=${{ startsWith(steps.semvercheck.outputs.match, 'true') }}
type=semver,pattern={{major}},enable=${{ startsWith(steps.semvercheck.outputs.match, 'true_nonzero') }}
type=raw,value=latest,enable=${{ startsWith(steps.semvercheck.outputs.match, 'true') }} Edited to fix some minor warnings when the semver tag pattern noticed a non-semver tag. |
Thanks @nearcatch this definitely helped. In the end I'm using: - name: Check for semver tag
id: semvercheck
run: |
if [[ ${{ github.ref }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
MATCH=true
else
MATCH=false
fi
if [[ ! ${{ github.ref }} =~ ^refs/tags/v0\. ]]; then
MATCH=$MATCH_nonzero
fi
echo ::set-output name=match::$MATCH
# extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v3
with:
flavor: |
latest=${{ github.ref == 'refs/heads/master' }}
images: |
qmcgaw/gluetun
qmcgaw/private-internet-access
tags: |
type=ref,event=branch,enable=${{ github.ref != 'refs/heads/master' }}
type=ref,event=pr
type=ref,event=tag,enable=${{ !startsWith(steps.semvercheck.outputs.match, 'true') }}
type=semver,pattern=v{{major}}.{{minor}}.{{patch}},enable=${{ startsWith(steps.semvercheck.outputs.match, 'true') }}
type=semver,pattern=v{{major}}.{{minor}},enable=${{ startsWith(steps.semvercheck.outputs.match, 'true') }}
type=semver,pattern=v{{major}},enable=${{ startsWith(steps.semvercheck.outputs.match, 'true_nonzero') }}
type=raw,value=latest,enable=${{ !startsWith(steps.semvercheck.outputs.match, 'true') }} It seems to push |
@nearcatch unfortunately gluetun/.github/workflows/ci.yml Lines 122 to 128 in b9a9319
and gluetun/.github/workflows/ci.yml Line 143 in b9a9319
only pushed v3.26.0 on the last release. Any idea how to fix it to push also v3 and v3.26? Workflow relevant logs: |
I have no idea why but it's actually failing here, with any semver tag that isn't v0.Y.Z. This makes the semvercheck.outputs.match variable empty. Then the gluetun/.github/workflows/ci.yml Line 124 in b9a9319
while these lines for the v<major> , v<major>.<minor> , and v<major>.<minor>.<patch> semver tags are ignored:gluetun/.github/workflows/ci.yml Lines 125 to 127 in b9a9319
I've done some quick testing and this code seems to work properly with non-zero semver tags: - name: Check for semver tag
id: semvercheck
run: |
if [[ ${{ github.ref }} =~ ^refs\/tags\/v0\.[0-9]+\.[0-9]+$ ]]; then
MATCH=true
else
MATCH=false
fi
if [[ ${{ github.ref }} =~ ^refs\/tags\/v[1-9]+\.[0-9]+\.[0-9]+$ ]]; then
MATCH=true_nonzero
fi
echo ::set-output name=match::$MATCH |
I'm going to write my own Github action to do all this, the current build setup is just misbehaving and hard to reason about/configure. Key points will be:
I'll try to get this done asap for release v3.28.0. |
Done in 2b09b9c! 👍 I ended up fixing the existing docker-meta action this morning. You now have image tag |
What's the feature? 🧐
Make the
latest
tag in docker point to the latest release instead of a dev build.latest
tag, and dev builds on something like thedev
tagOptional extra information 🚀
The text was updated successfully, but these errors were encountered: