Skip to content

Commit

Permalink
Create container-latest.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
timia2109 committed Feb 15, 2024
1 parent f990711 commit 0eaa878
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/container-latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# 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" ]

jobs:
build-server:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup .NET
uses: actions/setup-dotnet@v3
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@v3.1.3
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@v3.0.2
with:
name: backend-artifacts
path: 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 }}:master

- 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 }}

0 comments on commit 0eaa878

Please sign in to comment.