Skip to content

Commit

Permalink
Merge pull request #24 from iquzart/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
iquzart authored Feb 28, 2023
2 parents bf5b0e2 + d18aa57 commit 75d9744
Showing 1 changed file with 35 additions and 13 deletions.
48 changes: 35 additions & 13 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
name: Build and Push to Docker Hub

on:
schedule:
- cron: '0 10 * * 0'
push:
branches: [master, release/*]
branches:
- '**'
tags:
- '*'
- 'v*.*.*'
pull_request:

env:
DOCKER_IMAGE: diquzart/go-app

jobs:
build-and-push:
Expand All @@ -14,23 +21,38 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.DOCKER_IMAGE }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: ./Containerfile
args: |
--file ./Containerfile
--push
--tag diquzart/go-app:latest
--tag diquzart/go-app:${{ github.sha }}
--tag diquzart/go-app:${{ github.ref }}
--build-arg VERSION=${{ github.sha }}
secrets:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
context: .
file: ./Containerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
build-args: |
VERSION=${{ github.sha }}

0 comments on commit 75d9744

Please sign in to comment.