mirror of https://gitee.com/answerdev/answer.git
61 lines
1.3 KiB
YAML
61 lines
1.3 KiB
YAML
name: Build Docker Hub Image
|
|
|
|
on:
|
|
push:
|
|
branches: [ "main" ]
|
|
tags:
|
|
- v2.*
|
|
- v1.*
|
|
- v0.*
|
|
# pull_request:
|
|
# branches: [ "main" ]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v2
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
with:
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Extract metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v3
|
|
with:
|
|
images: answerdev/answer
|
|
tags: |
|
|
type=raw,value=latest
|
|
# branch event
|
|
type=ref,enable=true,priority=600,prefix=,suffix=,event=branch
|
|
# tag event
|
|
#type=ref,enable=true,priority=600,prefix=,suffix=,event=tag
|
|
type=semver,pattern={{version}}
|
|
|
|
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
|
|
|
|