Skip to content

Update dotnet.yml

Update dotnet.yml #7

Workflow file for this run

name: Build & Publish
on:
push:
branches: [ "master" ]
paths-ignore:
- "*.md"
pull_request:
branches: [ "master" ]
paths-ignore:
- "*.md"
workflow_dispatch:
env:
APP_NAME: 'OneCloud.S3.API'
DOTNET_VERSION: '8.0.x'
jobs:
build-and-publish:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Setup .NET
uses: actions/setup-dotnet@main
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Check out the repo
uses: actions/checkout@main
- name: Restore dependencies
working-directory: ./${{env.APP_NAME}}/
run: dotnet restore
- name: Build
working-directory: ./${{env.APP_NAME}}/
run: dotnet build --no-restore --configuration Release
- name: Log in to Container Registry
uses: docker/login-action@master
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Container Image
working-directory: ./${{env.APP_NAME}}/
run: dotnet publish -p:PublishProfile=DefaultContainer -p:ContainerImageName=ghcr.io/${{ github.repository }} -c Release
- name: Push Image to Container Registry
run: docker push ghcr.io/${{ github.repository }} --all-tags