Skip to content

Update docker-image.yml #22

Update docker-image.yml

Update docker-image.yml #22

Workflow file for this run

name: Docker Image CI
on:
push:
branches: [ "master" ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Install xmlstarlet
run: sudo apt-get install -y xmlstarlet
- name: Extract version
id: get_version
run: |
VERSION=$(xmlstarlet sel -t -v "//Project/PropertyGroup/Version" src/Sylvre.WebAPI/Sylvre.WebAPI.csproj)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Log in to GHCR
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build and push
run: |
IMAGE_NAME=ghcr.io/shahzaib-m/sylvre
VERSION=${{ env.VERSION }}
docker build -f src/Sylvre.WebAPI/Dockerfile -t $IMAGE_NAME:$VERSION -t $IMAGE_NAME:latest src/
docker push $IMAGE_NAME:$VERSION
docker push $IMAGE_NAME:latest