Skip to content

Format

Format #10

Workflow file for this run

name: Docker Build and Push
on:
push:
branches:
- main
tags:
- 'v*'
env:
REGISTRY: registry.k8s.yyz1.hammy.network
IMAGE_NAME: blog
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to the Docker registry
uses: docker/login-action@v2
with:
registry: registry.k8s.yyz1.hammy.network
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Get Build Time
run: echo "TIME=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
env:
COMMIT: ${{ github.sha }}
REF: ${{ github.ref }}
TIME: ${{ env.TIME }}