Skip to content

Update build_event_buddy.yml #3

Update build_event_buddy.yml

Update build_event_buddy.yml #3

name: Build and Push Docker Image
on:
push:
branches:
- main
env:
IMAGE_NAME: event-buddy
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get release version
id: release-version
run: |
VERSION-$(awk '/APP_VERSION/{print $NF}' config/event-buddy-values.yaml)
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "VERSION=$VERSION"
- name: Build image
run: docker build --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" .
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push image
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
echo IMAGE_ID=$IMAGE_ID
echo VERSION=${{ needs.label.outputs.release-version }}
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
- name: Create Release
uses: elgohr/Github-Release-Action@v5
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
title: Event Buddy Release - ${{ needs.label.outputs.release-version }}
tag: ${{ needs.label.outputs.release-version }}