Skip to content

Commit

Permalink
add workflow to build and push docker images
Browse files Browse the repository at this point in the history
  • Loading branch information
corsicanec82 committed Sep 6, 2024
1 parent 0d30a31 commit 9f1679b
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: build

on:
push:
branches:
- main

env:
DOCKER_BUILD_RECORD_UPLOAD: false
DOCKER_BUILD_SUMMARY: false

jobs:
prepare:
runs-on: ubuntu-latest
outputs:
directories: ${{ steps.set_directories.outputs.directories }}

steps:
- uses: actions/checkout@v4

- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
multi-language:
- 'multi-language/**'
checkstyle:
- 'checkstyle/**'
sqlint:
- 'sqlint/**'
phpcs:
- 'phpcs/**'
layout-designer-lint:
- 'layout-designer-lint/**'
python-flake8:
- 'python-flake8/**'
golangci-lint:
- 'golangci-lint/**'
rubocop:
- 'rubocop/**'
eslint:
- 'eslint/**'
nulllint:
- 'nulllint/**'
- id: set_directories
run: echo "directories=${{ toJson(steps.changes.outputs.changes) }}" >> "$GITHUB_OUTPUT"

build:
needs: prepare
if: ${{ needs.prepare.outputs.directories != '[]' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
directory: ${{ fromJson(needs.prepare.outputs.directories) }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Login to YC Registry
uses: docker/login-action@v3
with:
registry: cr.yandex
username: ${{ secrets.YCR_USERNAME }}
password: ${{ secrets.YCR_PASSWORD }}

- name: Build and Push
uses: docker/build-push-action@v6
with:
context: ${{ matrix.directory }}
push: true
tags: cr.yandex/${{ secrets.YCR_ID }}/common-${{ matrix.directory }}:latest
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# hexlet-common-images

[![Build](https://github.com/Hexlet/hexlet-common-images/workflows/Build/badge.svg)](https://github.com/Hexlet/hexlet-common-images/actions)

[![Hexlet Ltd. logo](https://raw.githubusercontent.com/Hexlet/assets/master/images/hexlet_logo128.png)](https://hexlet.io/?utm_source=github&utm_medium=link&utm_campaign=hexlet-common-images)

This repository is created and maintained by the team and the community of Hexlet, an educational project. [Read more about Hexlet](https://hexlet.io/?utm_source=github&utm_medium=link&utm_campaign=hexlet-common-images).
Expand Down

0 comments on commit 9f1679b

Please sign in to comment.