Files
workflows/.github/workflows/build.yaml
2024-12-24 11:34:53 +03:00

40 lines
1.3 KiB
YAML

on:
workflow_call:
jobs:
build:
runs-on: gpu
env:
#DOCKER_HOST: tcp://${{ matrix.config.host }}:2376
CR_REGISTRY: crp8vh46gd976oq8ipla
CR_REPO: ${{ github.event.repository.name }}
IMAGE_TAG: ${{ github.sha }}
steps:
- name: Checkout
run: |
git init
git remote add origin git@$${{ github.server_url }}:${{ github.repository }}.git
git fetch --depth 1 origin ${{ github.ref }}
git checkout FETCH_HEAD
git lfs pull
- name: Use ssh key
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.LIB_SSH_KEY }}
- name: Build image
run: |
docker build -t cr.yandex/$CR_REGISTRY/$CR_REPO:${IMAGE_TAG::7} --ssh default .
- name: Yandex Cloud Login
uses: yc-actions/yc-cr-login@v2
with:
yc-sa-json-credentials: ${{ secrets.YC_SA_JSON_CREDENTIALS }}
- name: Tag image
run: |
docker tag cr.yandex/$CR_REGISTRY/$CR_REPO:${IMAGE_TAG::7} cr.yandex/$CR_REGISTRY/$CR_REPO:latest
- name: Push image
run: |
docker push cr.yandex/$CR_REGISTRY/$CR_REPO:${IMAGE_TAG::7}
docker push cr.yandex/$CR_REGISTRY/$CR_REPO:latest