Corrected metadata-action config for latest tag (#623)
This commit is contained in:
1 parent
c70470dbb1
commit
5f022ac58e
1 file changed
+4
-3
@@ -0,0 +1,85 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- test/**
|
||||
tags:
|
||||
- "[0-9]+.[0-9]+.[0-9]+"
|
||||
paths-ignore:
|
||||
- README.md
|
||||
- "examples/**"
|
||||
- "docs/**"
|
||||
- "renovate.json5"
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
paths-ignore:
|
||||
- README.md
|
||||
- "examples/**"
|
||||
- "docs/**"
|
||||
- "renovate.json5"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'itzg/docker-minecraft-bedrock-server'
|
||||
env:
|
||||
IMAGE_BASE_NAME: minecraft-bedrock-server
|
||||
|
||||
steps:
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Login to DockerHub
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USER }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Login to GHCR
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v3.6.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ github.token }}
|
||||
|
||||
- name: Docker Metadata action
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
${{ github.repository_owner }}/${{ env.IMAGE_BASE_NAME }}
|
||||
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_BASE_NAME }}
|
||||
tags: |
|
||||
# pushes a tag matching the release/tag
|
||||
type=pep440,pattern={{version}}
|
||||
# stable is a moving tag that points to the latest release
|
||||
type=pep440,pattern=stable
|
||||
# and latest is a tag that always latest changes merged to default branch
|
||||
type=raw,value=latest,enable=${{ github.ref_name == github.event.repository.default_branch }}
|
||||
flavor: |
|
||||
latest=false
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
provenance: false
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: |
|
||||
${{ steps.meta.outputs.labels }}
|
||||
manymine.enable=true
|
||||
pull: true
|
||||
build-args: |
|
||||
BUILDTIME=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
|
||||
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
|
||||
REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
Reference in new issue
Block a user