Skip to content

Build and Release

Build and Release #10

Workflow file for this run

name: Build and Release
on:
workflow_run:
workflows: [ "Do SonarQube Analysis" ]
branches: [ "main" ]
types:
- completed
jobs:
build-n-release:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success'
permissions:
packages: write
concurrency:
cancel-in-progress: true
group: ${{ github.repository }}-${{ github.event_name }}-builder
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set env var for tag
if: github.event_name != 'pull_request'
run: |
if [[ "${{ github.event.head_commit.message }}" == WIP:* ]]; then
echo "DOCKER_IMAGE_TAG=wip" >> $GITHUB_ENV
else
echo "DOCKER_IMAGE_TAG=latest" >> $GITHUB_ENV
fi
- name: Build image and push to GHCR
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ghcr.io/luiggi33/berlin-police-feed:${{ env.DOCKER_IMAGE_TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max
github-token: ${{ secrets.GITHUB_TOKEN }}