Starlio-web/.github/workflows/docker.yml

50 lines
1.3 KiB
YAML
Raw Normal View History

2024-09-28 13:20:21 +03:00
name: Create and publish a Docker image
on:
push:
branches:
- main
release:
types:
- published
env:
2024-09-28 14:24:12 +03:00
REGISTRY: cr.yandex
IMAGE_NAME: starlio-web
REGISTRY_ID: ${{ secrets.YANDEX_REGISTRY_ID }}
2024-09-28 13:20:21 +03:00
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
2024-09-28 14:24:12 +03:00
username: oauth
password: ${{ secrets.YANDEX_OAUTH_TOKEN }}
2024-09-28 13:20:21 +03:00
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
2024-09-28 14:24:12 +03:00
images: ${{ env.REGISTRY }}/${{ env.REGISTRY_ID }}/${{ env.IMAGE_NAME }}
2024-09-28 13:20:21 +03:00
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
2024-09-28 14:24:12 +03:00
tags: ${{ env.REGISTRY }}/${{ env.REGISTRY_ID }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
2024-09-28 13:20:21 +03:00
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64