[workflow] use docker metadata action. move docker hub description to a separated flow.
This commit is contained in:
parent
7346a983e8
commit
b2a0c3885c
3 changed files with 51 additions and 45 deletions
22
.github/workflows/docker-hub-description.yml
vendored
Normal file
22
.github/workflows/docker-hub-description.yml
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
name: Update Docker Hub description
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types:
|
||||||
|
- created
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
name: Update Docker Hub description
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Update Docker Hub description
|
||||||
|
uses: peter-evans/dockerhub-description@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||||
|
repository: ${{ github.repository }}
|
||||||
|
short-description: ${{ github.event.repository.description }}
|
||||||
33
.github/workflows/on-push-main.yml
vendored
33
.github/workflows/on-push-main.yml
vendored
|
|
@ -15,43 +15,40 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Extract tag string
|
|
||||||
id: git
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
RELEASE_VERSION="dev-$(date +%s)"
|
|
||||||
echo "image_tag=${RELEASE_VERSION}" >> ${GITHUB_OUTPUT}
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v2
|
uses: docker/setup-qemu-action@v2
|
||||||
|
- name: Set up Docker Buildx
|
||||||
- name: Install buildx
|
|
||||||
uses: docker/setup-buildx-action@v2.7.0
|
uses: docker/setup-buildx-action@v2.7.0
|
||||||
|
|
||||||
- name: Login to docker hub
|
- name: Login to docker hub
|
||||||
uses: docker/login-action@v2.2.0
|
uses: docker/login-action@v2.2.0
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
uses: docker/login-action@v2.2.0
|
uses: docker/login-action@v2.2.0
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
password: ${{ github.token }}
|
password: ${{ github.token }}
|
||||||
|
- name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v4
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
${{ github.repository }}
|
||||||
|
ghcr.io/${{ github.repository }}
|
||||||
|
tags: |
|
||||||
|
type=raw,value=dev-{{date 'X'}}
|
||||||
|
type=raw,value=development
|
||||||
|
type=ref,event=branch
|
||||||
|
type=edge,branch=main
|
||||||
- name: Build and push ${{ github.repository }}:${{ steps.git.outputs.image_tag }}
|
- name: Build and push ${{ github.repository }}:${{ steps.git.outputs.image_tag }}
|
||||||
uses: docker/build-push-action@v4.1.1
|
uses: docker/build-push-action@v4.1.1
|
||||||
with:
|
with:
|
||||||
platforms: ${{ env.PLATFORMS }}
|
platforms: ${{ env.PLATFORMS }}
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
${{ github.repository }}:${{ steps.git.outputs.image_tag }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
${{ github.repository }}:development
|
|
||||||
ghcr.io/${{ github.repository }}:${{ steps.git.outputs.image_tag }}
|
|
||||||
ghcr.io/${{ github.repository }}:development
|
|
||||||
|
|
||||||
clean-ghcr:
|
clean-ghcr:
|
||||||
name: Delete old dev container images
|
name: Delete old dev container images
|
||||||
|
|
|
||||||
41
.github/workflows/on-release.yml
vendored
41
.github/workflows/on-release.yml
vendored
|
|
@ -14,48 +14,35 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Extract tag string
|
|
||||||
id: git
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
RELEASE_VERSION=${GITHUB_REF#refs/*/}
|
|
||||||
echo "image_tag=${RELEASE_VERSION}" >> ${GITHUB_OUTPUT}
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v2
|
uses: docker/setup-qemu-action@v2
|
||||||
|
- name: Set up Docker Buildx
|
||||||
- name: Install buildx
|
|
||||||
uses: docker/setup-buildx-action@v2.7.0
|
uses: docker/setup-buildx-action@v2.7.0
|
||||||
|
|
||||||
- name: Login to docker hub
|
- name: Login to docker hub
|
||||||
uses: docker/login-action@v2.2.0
|
uses: docker/login-action@v2.2.0
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
uses: docker/login-action@v2.2.0
|
uses: docker/login-action@v2.2.0
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
password: ${{ github.token }}
|
password: ${{ github.token }}
|
||||||
|
- name: Docker meta
|
||||||
- name: Build and push ${{ github.repository }}:${{ steps.git.outputs.image_tag }}
|
id: meta
|
||||||
|
uses: docker/metadata-action@v4
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
${{ github.repository }}
|
||||||
|
ghcr.io/${{ github.repository }}
|
||||||
|
tags: |
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=tag
|
||||||
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v4.1.1
|
uses: docker/build-push-action@v4.1.1
|
||||||
with:
|
with:
|
||||||
platforms: ${{ env.PLATFORMS }}
|
platforms: ${{ env.PLATFORMS }}
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
${{ github.repository }}:${{ steps.git.outputs.image_tag }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
${{ github.repository }}:latest
|
|
||||||
ghcr.io/${{ github.repository }}:${{ steps.git.outputs.image_tag }}
|
|
||||||
ghcr.io/${{ github.repository }}:latest
|
|
||||||
|
|
||||||
- name: Update dockerhub description
|
|
||||||
uses: peter-evans/dockerhub-description@v3
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
|
||||||
repository: ${{ github.repository }}
|
|
||||||
short-description: ${{ github.event.repository.description }}
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue