Skip to content

Commit

Permalink
chore: smart docker tags
Browse files Browse the repository at this point in the history
  • Loading branch information
snowdream committed Oct 2, 2024
1 parent b0b411c commit e644968
Show file tree
Hide file tree
Showing 6 changed files with 169 additions and 52 deletions.
53 changes: 40 additions & 13 deletions .github/workflows/alpine-frpc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,33 @@ name: GitHub Actions Continuous Delivery (Alpine Frpc)
on:
push:
branches:
- main
- "main"
- "dev"
- "feat/**"
- "feature/**"
- "fix/**"
- "pr/**"
tags:
- "*"
- "[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+"
- "V[0-9]+.[0-9]+.[0-9]+"
- "alpine-[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+"
- "V[0-9]+.[0-9]+"
- "alpine-[0-9]+.[0-9]+"
- "[0-9]+"
- "v[0-9]+"
- "V[0-9]+"
- "alpine-[0-9]+"
pull_request:
branches:
- "main"
- "dev"
- "feat/**"
- "feature/**"
- "fix/**"
- "pr/**"
schedule:
# Automatically run on every Day
- cron: "0 17 * * *"
Expand Down Expand Up @@ -67,27 +91,30 @@ jobs:
type=edge,enable=true,priority=700,prefix=,suffix=,branch=dev
type=raw,enable={{is_default_branch}},priority=200,prefix=,suffix=,value=latest
type=raw,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=200,prefix=,suffix=,value=latest
type=pep440,enable=true,priority=900,prefix=,suffix=,pattern={{version}}
type=pep440,enable=true,priority=900,prefix=,suffix=,pattern={{major}}.{{minor}}
type=pep440,enable=${{ !startsWith(github.ref, 'refs/tags/v0.') && !startsWith(github.ref, 'refs/tags/0.') }},priority=900,prefix=,suffix=,pattern={{major}}
type=schedule,enable=true,priority=1000,prefix=,suffix=,pattern=nightly
type=match,enable=true,priority=800,prefix=,suffix=,pattern=\d+.\d+.\d+,group=0,value=
type=match,enable=true,priority=800,prefix=,suffix=,pattern=\d+.\d+,group=0,value=
type=match,enable=${{ !startsWith(github.ref, 'refs/tags/0.') && !startsWith(github.ref, 'refs/tags/v0.') && !startsWith(github.ref, 'refs/tags/V0.') && !startsWith(github.ref, 'refs/tags/alpine-0.') && !startsWith(github.ref, 'refs/tags/alpine-v0.') && !startsWith(github.ref, 'refs/tags/alpine-V0.') }},priority=800,prefix=,suffix=,pattern=\d+,group=0,value=
type=ref,enable=true,priority=600,prefix=,suffix=-alpine,event=branch
type=edge,enable=true,priority=700,prefix=,suffix=-alpine,branch=dev
type=raw,enable={{is_default_branch}},priority=200,prefix=,suffix=,value=alpine
type=raw,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=200,prefix=,suffix=,value=alpine
type=pep440,enable=true,priority=900,prefix=,suffix=-alpine,pattern={{version}}
type=pep440,enable=true,priority=900,prefix=,suffix=-alpine,pattern={{major}}.{{minor}}
type=pep440,enable=${{ !startsWith(github.ref, 'refs/tags/v0.') && !startsWith(github.ref, 'refs/tags/0.') }},priority=900,prefix=,suffix=-alpine,pattern={{major}}
type=schedule,enable=true,priority=1000,prefix=,suffix=-alpine,pattern=nightly
type=match,enable=true,priority=800,prefix=,suffix=-alpine,pattern=\d+.\d+.\d+,group=0,value=
type=match,enable=true,priority=800,prefix=,suffix=-alpine,pattern=\d+.\d+,group=0,value=
type=match,enable=${{ !startsWith(github.ref, 'refs/tags/0.') && !startsWith(github.ref, 'refs/tags/v0.') && !startsWith(github.ref, 'refs/tags/V0.') && !startsWith(github.ref, 'refs/tags/alpine-0.') && !startsWith(github.ref, 'refs/tags/alpine-v0.') && !startsWith(github.ref, 'refs/tags/alpine-V0.') }},priority=800,prefix=,suffix=-alpine,pattern=\d+,group=0,value=
type=ref,enable=true,priority=600,prefix=,suffix=-alpine3.20,event=branch
type=edge,enable=true,priority=700,prefix=,suffix=-alpine3.20,branch=dev
type=raw,enable={{is_default_branch}},priority=200,prefix=,suffix=,value=alpine3.20
type=raw,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=200,prefix=,suffix=,value=alpine3.20
type=pep440,enable=true,priority=900,prefix=,suffix=-alpine3.20,pattern={{version}}
type=pep440,enable=true,priority=900,prefix=,suffix=-alpine3.20,pattern={{major}}.{{minor}}
type=pep440,enable=${{ !startsWith(github.ref, 'refs/tags/v0.') && !startsWith(github.ref, 'refs/tags/0.') }},priority=900,prefix=,suffix=-alpine3.20,pattern={{major}}
type=schedule,enable=true,priority=1000,prefix=,suffix=-alpine3.20,pattern=nightly
type=match,enable=true,priority=800,prefix=,suffix=-alpine3.20,pattern=\d+.\d+.\d+,group=0,value=
type=match,enable=true,priority=800,prefix=,suffix=-alpine3.20,pattern=\d+.\d+,group=0,value=
type=match,enable=${{ !startsWith(github.ref, 'refs/tags/0.') && !startsWith(github.ref, 'refs/tags/v0.') && !startsWith(github.ref, 'refs/tags/V0.') && !startsWith(github.ref, 'refs/tags/alpine-0.') && !startsWith(github.ref, 'refs/tags/alpine-v0.') && !startsWith(github.ref, 'refs/tags/alpine-V0.') }},priority=800,prefix=,suffix=-alpine3.20,pattern=\d+,group=0,value=
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
- name: Build and push
uses: docker/build-push-action@v6.7.0
uses: docker/build-push-action@v6.9.0
with:
context: alpine/frpc
build-args: |
Expand All @@ -98,7 +125,7 @@ jobs:
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/riscv64,linux/s390x
push: ${{ github.event_name != 'pull_request' }}
push: ${{ github.event_name != 'pull_request' && !startsWith(github.ref, 'refs/heads/feat/') && !startsWith(github.ref, 'refs/heads/feature/') && !startsWith(github.ref, 'refs/heads/fix/') && !startsWith(github.ref, 'refs/heads/pr/') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
Expand Down
53 changes: 40 additions & 13 deletions .github/workflows/alpine-frps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,33 @@ name: GitHub Actions Continuous Delivery (Alpine Frps)
on:
push:
branches:
- main
- "main"
- "dev"
- "feat/**"
- "feature/**"
- "fix/**"
- "pr/**"
tags:
- "*"
- "[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+"
- "V[0-9]+.[0-9]+.[0-9]+"
- "alpine-[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+"
- "V[0-9]+.[0-9]+"
- "alpine-[0-9]+.[0-9]+"
- "[0-9]+"
- "v[0-9]+"
- "V[0-9]+"
- "alpine-[0-9]+"
pull_request:
branches:
- "main"
- "dev"
- "feat/**"
- "feature/**"
- "fix/**"
- "pr/**"
schedule:
# Automatically run on every Day
- cron: "0 17 * * *"
Expand Down Expand Up @@ -67,27 +91,30 @@ jobs:
type=edge,enable=true,priority=700,prefix=,suffix=,branch=dev
type=raw,enable={{is_default_branch}},priority=200,prefix=,suffix=,value=latest
type=raw,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=200,prefix=,suffix=,value=latest
type=pep440,enable=true,priority=900,prefix=,suffix=,pattern={{version}}
type=pep440,enable=true,priority=900,prefix=,suffix=,pattern={{major}}.{{minor}}
type=pep440,enable=${{ !startsWith(github.ref, 'refs/tags/v0.') && !startsWith(github.ref, 'refs/tags/0.') }},priority=900,prefix=,suffix=,pattern={{major}}
type=schedule,enable=true,priority=1000,prefix=,suffix=,pattern=nightly
type=match,enable=true,priority=800,prefix=,suffix=,pattern=\d+.\d+.\d+,group=0,value=
type=match,enable=true,priority=800,prefix=,suffix=,pattern=\d+.\d+,group=0,value=
type=match,enable=${{ !startsWith(github.ref, 'refs/tags/0.') && !startsWith(github.ref, 'refs/tags/v0.') && !startsWith(github.ref, 'refs/tags/V0.') && !startsWith(github.ref, 'refs/tags/alpine-0.') && !startsWith(github.ref, 'refs/tags/alpine-v0.') && !startsWith(github.ref, 'refs/tags/alpine-V0.') }},priority=800,prefix=,suffix=,pattern=\d+,group=0,value=
type=ref,enable=true,priority=600,prefix=,suffix=-alpine,event=branch
type=edge,enable=true,priority=700,prefix=,suffix=-alpine,branch=dev
type=raw,enable={{is_default_branch}},priority=200,prefix=,suffix=,value=alpine
type=raw,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=200,prefix=,suffix=,value=alpine
type=pep440,enable=true,priority=900,prefix=,suffix=-alpine,pattern={{version}}
type=pep440,enable=true,priority=900,prefix=,suffix=-alpine,pattern={{major}}.{{minor}}
type=pep440,enable=${{ !startsWith(github.ref, 'refs/tags/v0.') && !startsWith(github.ref, 'refs/tags/0.') }},priority=900,prefix=,suffix=-alpine,pattern={{major}}
type=schedule,enable=true,priority=1000,prefix=,suffix=-alpine,pattern=nightly
type=match,enable=true,priority=800,prefix=,suffix=-alpine,pattern=\d+.\d+.\d+,group=0,value=
type=match,enable=true,priority=800,prefix=,suffix=-alpine,pattern=\d+.\d+,group=0,value=
type=match,enable=${{ !startsWith(github.ref, 'refs/tags/0.') && !startsWith(github.ref, 'refs/tags/v0.') && !startsWith(github.ref, 'refs/tags/V0.') && !startsWith(github.ref, 'refs/tags/alpine-0.') && !startsWith(github.ref, 'refs/tags/alpine-v0.') && !startsWith(github.ref, 'refs/tags/alpine-V0.') }},priority=800,prefix=,suffix=-alpine,pattern=\d+,group=0,value=
type=ref,enable=true,priority=600,prefix=,suffix=-alpine3.20,event=branch
type=edge,enable=true,priority=700,prefix=,suffix=-alpine3.20,branch=dev
type=raw,enable={{is_default_branch}},priority=200,prefix=,suffix=,value=alpine3.20
type=raw,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=200,prefix=,suffix=,value=alpine3.20
type=pep440,enable=true,priority=900,prefix=,suffix=-alpine3.20,pattern={{version}}
type=pep440,enable=true,priority=900,prefix=,suffix=-alpine3.20,pattern={{major}}.{{minor}}
type=pep440,enable=${{ !startsWith(github.ref, 'refs/tags/v0.') && !startsWith(github.ref, 'refs/tags/0.') }},priority=900,prefix=,suffix=-alpine3.20,pattern={{major}}
type=schedule,enable=true,priority=1000,prefix=,suffix=-alpine3.20,pattern=nightly
type=match,enable=true,priority=800,prefix=,suffix=-alpine3.20,pattern=\d+.\d+.\d+,group=0,value=
type=match,enable=true,priority=800,prefix=,suffix=-alpine3.20,pattern=\d+.\d+,group=0,value=
type=match,enable=${{ !startsWith(github.ref, 'refs/tags/0.') && !startsWith(github.ref, 'refs/tags/v0.') && !startsWith(github.ref, 'refs/tags/V0.') && !startsWith(github.ref, 'refs/tags/alpine-0.') && !startsWith(github.ref, 'refs/tags/alpine-v0.') && !startsWith(github.ref, 'refs/tags/alpine-V0.') }},priority=800,prefix=,suffix=-alpine3.20,pattern=\d+,group=0,value=
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
- name: Build and push
uses: docker/build-push-action@v6.7.0
uses: docker/build-push-action@v6.9.0
with:
context: alpine/frps
build-args: |
Expand All @@ -98,7 +125,7 @@ jobs:
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/riscv64,linux/s390x
push: ${{ github.event_name != 'pull_request' }}
push: ${{ github.event_name != 'pull_request' && !startsWith(github.ref, 'refs/heads/feat/') && !startsWith(github.ref, 'refs/heads/feature/') && !startsWith(github.ref, 'refs/heads/fix/') && !startsWith(github.ref, 'refs/heads/pr/') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
Expand Down
46 changes: 36 additions & 10 deletions .github/workflows/debian-frpc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,33 @@ name: GitHub Actions Continuous Delivery (Debian Frpc)
on:
push:
branches:
- main
- "main"
- "dev"
- "feat/**"
- "feature/**"
- "fix/**"
- "pr/**"
tags:
- "*"
- "[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+"
- "V[0-9]+.[0-9]+.[0-9]+"
- "debian-[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+"
- "V[0-9]+.[0-9]+"
- "debian-[0-9]+.[0-9]+"
- "[0-9]+"
- "v[0-9]+"
- "V[0-9]+"
- "debian-[0-9]+"
pull_request:
branches:
- "main"
- "dev"
- "feat/**"
- "feature/**"
- "fix/**"
- "pr/**"
schedule:
# Automatically run on every Day
- cron: "0 17 * * *"
Expand Down Expand Up @@ -67,20 +91,22 @@ jobs:
type=edge,enable=true,priority=700,prefix=,suffix=-debian,branch=dev
type=raw,enable={{is_default_branch}},priority=200,prefix=,suffix=,value=debian
type=raw,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=200,prefix=,suffix=,value=debian
type=pep440,enable=true,priority=900,prefix=,suffix=-debian,pattern={{version}}
type=pep440,enable=true,priority=900,prefix=,suffix=-debian,pattern={{major}}.{{minor}}
type=pep440,enable=${{ !startsWith(github.ref, 'refs/tags/v0.') && !startsWith(github.ref, 'refs/tags/0.') }},priority=900,prefix=,suffix=-debian,pattern={{major}}
type=schedule,enable=true,priority=1000,prefix=,suffix=-debian,pattern=nightly
type=match,enable=true,priority=800,prefix=,suffix=-debian,pattern=\d+.\d+.\d+,group=0,value=
type=match,enable=true,priority=800,prefix=,suffix=-debian,pattern=\d+.\d+,group=0,value=
type=match,enable=${{ !startsWith(github.ref, 'refs/tags/0.') && !startsWith(github.ref, 'refs/tags/v0.') && !startsWith(github.ref, 'refs/tags/V0.') && !startsWith(github.ref, 'refs/tags/debian-0.') && !startsWith(github.ref, 'refs/tags/debian-v0.') && !startsWith(github.ref, 'refs/tags/debian-V0.') }},priority=800,prefix=,suffix=-debian,pattern=\d+,group=0,value=
type=ref,enable=true,priority=600,prefix=,suffix=-bookworm,event=branch
type=edge,enable=true,priority=700,prefix=,suffix=-bookworm,branch=dev
type=raw,enable={{is_default_branch}},priority=200,prefix=,suffix=,value=bookworm
type=raw,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=200,prefix=,suffix=,value=bookworm
type=pep440,enable=true,priority=900,prefix=,suffix=-bookworm,pattern={{version}}
type=pep440,enable=true,priority=900,prefix=,suffix=-bookworm,pattern={{major}}.{{minor}}
type=pep440,enable=${{ !startsWith(github.ref, 'refs/tags/v0.') && !startsWith(github.ref, 'refs/tags/0.') }},priority=900,prefix=,suffix=-bookworm,pattern={{major}}
type=schedule,enable=true,priority=1000,prefix=,suffix=-bookworm,pattern=nightly
type=match,enable=true,priority=800,prefix=,suffix=-bookworm,pattern=\d+.\d+.\d+,group=0,value=
type=match,enable=true,priority=800,prefix=,suffix=-bookworm,pattern=\d+.\d+,group=0,value=
type=match,enable=${{ !startsWith(github.ref, 'refs/tags/0.') && !startsWith(github.ref, 'refs/tags/v0.') && !startsWith(github.ref, 'refs/tags/V0.') && !startsWith(github.ref, 'refs/tags/debian-0.') && !startsWith(github.ref, 'refs/tags/debian-v0.') && !startsWith(github.ref, 'refs/tags/debian-V0.') }},priority=800,prefix=,suffix=-bookworm,pattern=\d+,group=0,value=
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
- name: Build and push
uses: docker/build-push-action@v6.7.0
uses: docker/build-push-action@v6.9.0
with:
context: debian/frpc
build-args: |
Expand All @@ -91,7 +117,7 @@ jobs:
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
platforms: linux/386,linux/amd64,linux/arm/v5,linux/arm/v7,linux/arm64,linux/mips64le,linux/ppc64le,linux/s390x
push: ${{ github.event_name != 'pull_request' }}
push: ${{ github.event_name != 'pull_request' && !startsWith(github.ref, 'refs/heads/feat/') && !startsWith(github.ref, 'refs/heads/feature/') && !startsWith(github.ref, 'refs/heads/fix/') && !startsWith(github.ref, 'refs/heads/pr/') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
Expand Down
Loading

0 comments on commit e644968

Please sign in to comment.