Skip to content

ci: kzb-33 update build workflow #6

ci: kzb-33 update build workflow

ci: kzb-33 update build workflow #6

Workflow file for this run

name: Build
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v6
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to GitHub Docker Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Git commit SHA
id: get_sha
run: echo "GIT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Build Docker image
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
tags: |
ghcr.io/${{ github.repository }}/eapp:${{ github.run_number }}-${{ env.GIT_SHA }}
outputs: type=docker,dest=/tmp/eapp.tar
- name: Push Docker image
if: success()
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository }}/eapp:${{ github.run_number }}-${{ env.GIT_SHA }}
- name: Log out from Docker Registry
if: always()
run: docker logout ghcr.io