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

75 lines
2.1 KiB
YAML
Raw Normal View History

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