Skip to content

Commit

Permalink
ci: update build step
Browse files Browse the repository at this point in the history
  • Loading branch information
datagutt committed Oct 14, 2024
1 parent 50ac9d5 commit f2255d8
Showing 1 changed file with 41 additions and 35 deletions.
76 changes: 41 additions & 35 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,45 +1,51 @@
name: Release
name: Build and Push Image

on:
create:
push:
branches:
- main

jobs:
release:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
build:
name: Build and Push Docker Image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
- name: Checkout
uses: actions/checkout@v4

- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3

- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: actions/checkout@v2
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@master
with:
fetch-depth: 0
-
name: "Fetch latest tag"
id: get-latest-tag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
-
name: Build and push Redis 6.2.6
id: docker_build_6
uses: docker/build-push-action@v2
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v5
with:
build-args: |
REDIS_VERSION=6.2.6
context: .
file: ./Dockerfile
push: true
tags: |
flyio/redis:6.2.6
flyio/redis:6.2
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
platforms: linux/amd64, linux/arm64
context: .
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max

0 comments on commit f2255d8

Please sign in to comment.