Skip to content

build and publish container image #2

build and publish container image

build and publish container image #2

Workflow file for this run

name: Release
on:
workflow_dispatch:
push:
tags:
- v*
jobs:
build_and_release:
runs-on: ubuntu-latest
env:
DOTNET_VERSION: '7.0.x'
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Set version from tag
run: |
TAG_NAME=$(echo $GITHUB_REF | cut -d '/' -f 3)
VERSION=${TAG_NAME#v}
echo "TAG_VERSION=$VERSION" >> $GITHUB_ENV
echo "Updating project version to $VERSION"
sed -i "s/<AssemblyVersion>.*<\/AssemblyVersion>/<AssemblyVersion>$VERSION<\/AssemblyVersion>/g" Crisp.Core/Crisp.Core.csproj
sed -i "s/<FileVersion>.*<\/FileVersion>/<FileVersion>$VERSION<\/FileVersion>/g" Crisp.Core/Crisp.Core.csproj
sed -i "s/<AssemblyVersion>.*<\/AssemblyVersion>/<AssemblyVersion>$VERSION<\/AssemblyVersion>/g" Crisp.Ui/Crisp.Ui.csproj
sed -i "s/<FileVersion>.*<\/FileVersion>/<FileVersion>$VERSION<\/FileVersion>/g" Crisp.Ui/Crisp.Ui.csproj
working-directory: src
# - name: Restore dependencies
# run: dotnet restore
# working-directory: src/Crisp.Core
# - name: Build application
# run: dotnet build --configuration Release --no-restore
# working-directory: src/Crisp.Core
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: src
push: true
tags: |
anmalkov/crisp:$TAG_VERSION
anmalkov/crisp:latest