mirror of https://gitee.com/answerdev/answer.git
51 lines
1.0 KiB
YAML
51 lines
1.0 KiB
YAML
name: Build Docker Hub Image
|
|
|
|
on:
|
|
push:
|
|
branches: [ "main" ]
|
|
tags:
|
|
- 2.*
|
|
- 1.*
|
|
- 0.*
|
|
# pull_request:
|
|
# branches: [ "main" ]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
- 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
|
|
|
|
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
|
|
|
|