Skip to content

feat: add sonar

feat: add sonar #16

Workflow file for this run

name: Build docker image
on:
push:
branches: ['main']
pull_request:
# The branches below must be a subset of the branches above
branches: ['main']
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.extract_branch.outputs.branch }}
repository: ${{ steps.extract_repo.outputs.repository }}
steps:
- uses: actions/checkout@v4
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Extract repo name
shell: bash
run: echo "repository=${GITHUB_REPOSITORY@L}" >> $GITHUB_OUTPUT
id: extract_repo
build:
runs-on: ubuntu-latest
needs:
- prepare
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
ghcr.io/${{ needs.prepare.outputs.repository }}:${{ needs.prepare.outputs.branch }}