Skip to content

Use different download path #5

Use different download path

Use different download path #5

# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: Build DayFlags.Server
on:
push:
branches: ["master"]
env:
REGISTRY: ghcr.io
jobs:
build-server:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore DayFlags.Server dependencies
working-directory: DayFlags.Server
run: dotnet restore
- name: Build DayFlags.Server
run: dotnet publish -c Release --no-restore
- name: Upload DayFlags.Server Artifacts
uses: actions/upload-artifact@v4
with:
name: backend-artifacts
path: DayFlags.Server/bin/Release/net8.0/publish/
build-docker-image:
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
needs:
- build-server
steps:
- uses: actions/checkout@v4
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: backend-artifacts
path: DayFlags.Server/build/
- name: Docker Login
uses: docker/login-action@v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker Metadata action
id: docker_metadata
uses: docker/metadata-action@v5.0.0
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}
- name: Build and push Docker image
uses: docker/build-push-action@v5.1.0
with:
context: ./DayFlags.Server
push: true
tags: ${{ steps.docker_metadata.outputs.tags }}
labels: ${{ steps.docker_metadata.outputs.labels }}