Skip to content

Build triggered by @selfdocumentingcode on release-manager #79

Build triggered by @selfdocumentingcode on release-manager

Build triggered by @selfdocumentingcode on release-manager #79

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
with:
dotnet-version: 8.0.x
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '6.x'
- name: Execute GitVersion
id: gitversion
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true
- name: Display GitVersion config
uses: gittools/actions/gitversion/[email protected]
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: 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: ./docker-prod/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# Tag the commit with the version number
# - name: Tag the commit with the version number
# if: ${{ !env.ACT }}
# run: |
# git config --local user.email "${{ github.actor }}@users.noreply.github.com"
# git config --local user.name "${{ github.actor }}"
# git tag -f ${{ steps.gitversion.outputs.semVer }}
# git push origin --tags