Skip to content

Merge branch 'main' of github.com:csharpfritz/CopilotThatJawn #1

Merge branch 'main' of github.com:csharpfritz/CopilotThatJawn

Merge branch 'main' of github.com:csharpfritz/CopilotThatJawn #1

name: Build and Push Container
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '9.0.x'
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for container
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Build and push container
run: |
dotnet publish Web/Web.csproj `
--os linux `
--arch x64 `
-c Release `
--self-contained `
/p:PublishProfile=DefaultContainer `
/p:ContainerImageName=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} `
/p:ContainerImageTags='${{ steps.meta.outputs.tags }}'