mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
ci: use docker metadata action for tags and labels
Also do not set latest tag on prerelease for the Docker image.
This commit is contained in:
parent
1dd229a591
commit
c0c2aa2348
25
.github/workflows/build.yml
vendored
25
.github/workflows/build.yml
vendored
@ -111,22 +111,33 @@ jobs:
|
|||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
password: ${{ secrets.GHCR_TOKEN }}
|
password: ${{ secrets.GHCR_TOKEN }}
|
||||||
|
|
||||||
|
- name: Generate Docker tags and labels
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v4
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
${{ github.event.repository.full_name }}
|
||||||
|
ghcr.io/${{ github.event.repository.full_name }}
|
||||||
|
tags: |
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=tag
|
||||||
|
type=ref,event=pr
|
||||||
|
flavor: |
|
||||||
|
latest=${{ github.event.release.prerelease == false }}
|
||||||
|
|
||||||
- name: Build Docker image
|
- name: Build Docker image
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
# platforms: linux/amd64,linux/arm64
|
# platforms: linux/amd64,linux/arm64
|
||||||
tags: |
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
${{ github.event.repository.full_name }}:latest
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
${{ github.event.repository.full_name }}:${{ github.event.release.tag_name }}
|
|
||||||
ghcr.io/${{ github.event.repository.full_name }}:latest
|
|
||||||
ghcr.io/${{ github.event.repository.full_name }}:${{ github.event.release.tag_name }}
|
|
||||||
|
|
||||||
- name: Check Docker image
|
- name: Check Docker image
|
||||||
working-directory: /tmp
|
working-directory: /tmp
|
||||||
run: |
|
run: |
|
||||||
docker run --rm -i -v ${PWD}:/docs ${{ github.event.repository.full_name }} new .
|
docker run --rm -i -v ${PWD}:/docs ${{ github.event.repository.full_name }}:${{ steps.meta.outputs.version }} new .
|
||||||
docker run --rm -i -v ${PWD}:/docs ${{ github.event.repository.full_name }} build
|
docker run --rm -i -v ${PWD}:/docs ${{ github.event.repository.full_name }}:${{ steps.meta.outputs.version }} build
|
||||||
|
|
||||||
- name: Publish Docker image
|
- name: Publish Docker image
|
||||||
env:
|
env:
|
||||||
|
Loading…
Reference in New Issue
Block a user