test build and push

This commit is contained in:
Abner Rizzi 2023-08-10 09:10:11 -03:00
parent 94619dda12
commit ea50061017
1 changed files with 18 additions and 41 deletions

View File

@ -1,52 +1,29 @@
name: Build and Push docker name: ci
on: on:
push: push:
branches: branches:
- main - 'main'
- development
- feat*
- gh-action
tags:
- "v*"
pull_request:
branches:
- master
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs: jobs:
push-docker-image: docker:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 -
name: Set up QEMU
- name: Docker meta uses: docker/setup-qemu-action@v2
id: meta -
uses: docker/metadata-action@v4 name: Set up Docker Buildx
with: uses: docker/setup-buildx-action@v2
images: ${{ env.REGISTRY}}/${{ env.IMAGE_NAME }} -
flavor: latest=true name: Login to Docker Hub
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
- name: Login to image repository
uses: docker/login-action@v2 uses: docker/login-action@v2
with: with:
registry: ${{ env.REGISTRY }} username: ${{ secrets.DOCKERHUB_USERNAME }}
username: ${{ github.actor }} password: ${{ secrets.DOCKERHUB_TOKEN }}
password: ${{ secrets.GITHUB_TOKEN }} -
name: Build and push
- name: Build and push uses: docker/build-push-action@v4
uses: docker/build-push-action@v3
with: with:
context: . push: true
file: Dockerfile.base tags: user/app:latest
#push: ${{ github.ref_type == 'tag' || github.ref_name == 'main' || startsWith(github.ref_name, 'feat-')}}
push: ${{ github.ref_type == 'tag' || github.ref_name == 'main' || startsWith(github.ref_name, 'feat-') || startsWith(github.ref_name, 'gh-action') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}