Skip to content

Commit

Permalink
Add GitHub as registry
Browse files Browse the repository at this point in the history
  • Loading branch information
timia2109 committed Feb 15, 2024
1 parent 0eaa878 commit 07b3513
Showing 1 changed file with 31 additions and 29 deletions.
60 changes: 31 additions & 29 deletions .github/workflows/container-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,38 @@
name: Build DayFlags.Server

on:
push:
branches: [ "master" ]
push:
branches: ["master"]

env:
REGISTRY: ghcr.io

jobs:
build-server:
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

runs-on: ubuntu-latest
- name: Build DayFlags.Server
run: dotnet publish -c Release --no-restore

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/
- 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:
build-docker-image:
runs-on: ubuntu-22.04
permissions:
contents: read
Expand All @@ -42,26 +44,26 @@ jobs:
- 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:
Expand Down

0 comments on commit 07b3513

Please sign in to comment.