Skip to content

Commit

Permalink
feat: update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
phv2312 committed Sep 6, 2024
1 parent f89168f commit 4ea214c
Showing 1 changed file with 45 additions and 33 deletions.
78 changes: 45 additions & 33 deletions .github/workflows/build-push-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
branches:
- 'releases/**'
- main

workflow_dispatch:

Expand All @@ -26,41 +26,53 @@ jobs:
platform:
- linux/amd64
steps:
- name: Update Application Version
id: update-version
uses: anothrNick/github-tag-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
DEFAULT_BUMP: patch
MAJOR_STRING_TOKEN: "bump:major"
MINOR_STRING_TOKEN: "bump:minor"
PATCH_STRING_TOKEN: "bump:patch"

- name: Set repository and image name
if: github.event_name == 'workflow_dispatch' || steps.update-version.outputs.new_tag != steps.update-version.outputs.old_tag
run: |
echo "FULL_IMAGE_NAME=${{ env.REGISTRY }}/${IMAGE_NAME,,}" >>${GITHUB_ENV}
env:
IMAGE_NAME: "${{ github.repository }}"

- name: Checkout
uses: actions/checkout@v4

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

- name: Set up Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.FULL_IMAGE_NAME }}

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build docker image
uses: docker/build-push-action@v4
with:
file: Dockerfile
context: .
push: true
platforms: ${{ matrix.platform }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
load: true
# - name: Checkout
# uses: actions/checkout@v4
#
# - name: Set up Docker Buildx
# id: buildx
# uses: docker/setup-buildx-action@v2
#
# - name: Set up Docker meta
# id: meta
# uses: docker/metadata-action@v5
# with:
# images: ${{ env.FULL_IMAGE_NAME }}
#
# - name: Log in to the Container registry
# uses: docker/login-action@v3
# with:
# registry: ${{ env.REGISTRY }}
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Build docker image
# uses: docker/build-push-action@v4
# with:
# file: Dockerfile
# context: .
# push: true
# platforms: ${{ matrix.platform }}
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}
# cache-from: type=gha
# cache-to: type=gha,mode=max
# load: true

0 comments on commit 4ea214c

Please sign in to comment.