matrix_chatgpt_bot/.github/workflows/docker-release.yml

75 lines
2.1 KiB
YAML
Raw Normal View History

2023-04-10 02:52:18 +00:00
name: Publish Docker image
on:
workflow_dispatch:
release:
types: [published]
jobs:
push_to_registry:
2023-04-11 00:48:52 +00:00
name: Push Docker image to registry
2023-04-10 02:52:18 +00:00
runs-on: ubuntu-latest
steps:
2023-04-11 00:48:52 +00:00
- name: Check out the repo
2023-04-10 02:52:18 +00:00
uses: actions/checkout@v3
2023-04-11 00:48:52 +00:00
- name: Log in to Docker Hub
2024-04-24 08:48:23 +00:00
uses: docker/login-action@v3
2023-04-10 02:52:18 +00:00
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
2023-04-11 00:48:52 +00:00
- name: Login to GitHub Container Registry
2024-04-24 08:48:23 +00:00
uses: docker/login-action@v3
2023-04-11 00:48:52 +00:00
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker metadata
2023-04-10 02:52:18 +00:00
id: meta
2024-04-24 08:48:23 +00:00
uses: docker/metadata-action@v5
2023-04-10 02:52:18 +00:00
with:
images: hibobmaster/matrixchatgptbot
tags: |
type=raw,value=latest
type=ref,event=tag
2023-04-11 00:48:52 +00:00
- name: Set up QEMU
2024-04-24 08:48:23 +00:00
uses: docker/setup-qemu-action@v3
2023-04-10 02:52:18 +00:00
2023-04-11 00:48:52 +00:00
- name: Set up Docker Buildx
2024-04-24 08:48:23 +00:00
uses: docker/setup-buildx-action@v3
2023-04-11 00:48:52 +00:00
- name: Build and push Docker image(dockerhub)
2024-04-24 08:48:23 +00:00
uses: docker/build-push-action@v5
2023-04-10 02:52:18 +00:00
with:
context: .
2023-04-11 00:48:52 +00:00
platforms: linux/amd64,linux/arm64
2023-04-10 02:52:18 +00:00
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
2023-04-11 00:48:52 +00:00
cache-to: type=gha,mode=max
- name: Docker metadata(ghcr)
id: meta2
2024-04-24 08:48:23 +00:00
uses: docker/metadata-action@v5
2023-04-11 00:48:52 +00:00
with:
images: ghcr.io/hibobmaster/matrixchatgptbot
tags: |
type=raw,value=latest
2024-03-08 08:05:08 +00:00
type=ref,event=tag
2023-04-11 00:48:52 +00:00
type=sha,format=long
- name: Build and push Docker image(ghcr)
2024-04-24 08:48:23 +00:00
uses: docker/build-push-action@v5
2023-04-11 00:48:52 +00:00
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta2.outputs.tags }}
labels: ${{ steps.meta2.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max