-
Notifications
You must be signed in to change notification settings - Fork 1
45 lines (39 loc) · 1.24 KB
/
publish-dotnet-docker-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Build Docker Image
on:
workflow_call:
inputs:
project_path:
required: true
type: string
version:
required: true
type: string
jobs:
build:
name: Publish DotNet Docker Image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Generate variables
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Login to the Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish docker image
run: |
dotnet publish -t:PublishContainer -p:VersionPrefix="${{ inputs.version }}" -p:InformationalVersion="${{ inputs.version }}+${{ steps.vars.outputs.sha_short }}" -p:ContainerImageTag="${{ inputs.version }}" -p:ContainerRegistry="ghcr.io"
working-directory: ${{ inputs.project_path }}