Merge pull request #14 from fey/update-config-for-new-structure #34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
env: | |
REGISTRY_NAME: hexletbasics | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check image building | |
run: docker build . | |
build-push-notify: | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'push' }} | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set repository name | |
run: | | |
echo "REPOSITORY_NAME=$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}')" >> $GITHUB_ENV | |
- name: Build and push into docker hub | |
uses: docker/build-push-action@v5 | |
with: | |
repository: ${{ env.REGISTRY_NAME }}/${{ env.REPOSITORY_NAME }} | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
tags: latest | |
- name: Set fail Slack env vars | |
if: ${{ failure() }} | |
run: | | |
echo "SLACK_COLOR=#a30200" >> $GITHUB_ENV | |
- name: Send notification into Slack | |
if: ${{ always() }} | |
uses: rtCamp/[email protected] | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} |