added manual trigger and arm image

This commit is contained in:
stone-w4tch3r
2024-08-07 22:10:25 +05:00
parent eae0784b9a
commit d385038561

View File

@@ -1,49 +1,49 @@
name: Build and Publish Docker Image name: Build and Publish Docker Image
on: on:
push: workflow_dispatch: # Manual
branches: [ "master" ] # TODO here you can specify needed trigger
env:
env: REGISTRY: ghcr.io
REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }}
IMAGE_NAME: ${{ github.repository }}
jobs:
jobs: build-and-push-image:
build-and-push-image: runs-on: ubuntu-latest
runs-on: ubuntu-latest permissions:
permissions: contents: read
contents: read packages: write
packages: write
steps:
steps: - name: Checkout repository
- name: Checkout repository uses: actions/checkout@v3
uses: actions/checkout@v3
- name: Set up Docker Buildx
- name: Set up Docker Buildx uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
- name: Log in to the Container registry uses: docker/login-action@v2
uses: docker/login-action@v2 with:
with: registry: ${{ env.REGISTRY }}
registry: ${{ env.REGISTRY }} username: ${{ github.actor }}
username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
- name: Extract metadata (tags, labels) for Docker id: meta
id: meta uses: docker/metadata-action@v4
uses: docker/metadata-action@v4 with:
with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: |
tags: | type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=latest,enable={{is_default_branch}} type=sha
type=sha
- name: Build and push Docker image
- name: Build and push Docker image uses: docker/build-push-action@v4
uses: docker/build-push-action@v4 with:
with: context: .
context: . push: true
push: true tags: ${{ steps.meta.outputs.tags }}
tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }}
labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha
cache-from: type=gha cache-to: type=gha,mode=max
cache-to: type=gha,mode=max platforms: linux/amd64,linux/arm64