Skip to content

Build triggered by @selfdocumentingcode on feature/ordbokv2 #156

Build triggered by @selfdocumentingcode on feature/ordbokv2

Build triggered by @selfdocumentingcode on feature/ordbokv2 #156

Workflow file for this run

name: Build
run-name: >-
${{ github.event_name == 'workflow_dispatch' &&
format ('Build triggered by @{0} on {1}', github.actor, github.ref_name)
|| null }}
on:
push:
branches:
- main
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v3
with:
versionSpec: '6.0.x'
- name: Execute GitVersion
id: gitversion
uses: gittools/actions/gitversion/execute@v3
with:
useConfigFile: true
- name: Display GitVersion config
uses: gittools/actions/gitversion/command@v3
if: ${{ env.ACTIONS_RUNNER_DEBUG == 'true' }}
with:
arguments: '/showConfig'
- name: Output the FullSemVer variable
uses: gittools/actions/gitversion/[email protected]
if: ${{ env.ACTIONS_RUNNER_DEBUG == 'true' }}
with:
arguments: '/showvariable FullSemVer'
- name: Update the version number in the project files
uses: gittools/actions/gitversion/[email protected]
with:
arguments: '/updateprojectfiles'
- name: Test
run: dotnet test
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=branch,enable=${{ github.ref != format('refs/heads/{0}', 'main') }}
type=raw,value=${{ steps.gitversion.outputs.semVer }}
type=sha,format=long
- name: Build and push Docker image
uses: docker/[email protected]
with:
context: .
file: ./src/Nellebot/prod.Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}