Skip to content

Commit

Permalink
add build release
Browse files Browse the repository at this point in the history
  • Loading branch information
yurvon-screamo committed Aug 20, 2024
1 parent afc1164 commit 9f9fabc
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 23 deletions.
10 changes: 10 additions & 0 deletions .github/dotnet/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: dotnet setup
description: "base dotnet setup for project"
runs:
using: composite
steps:
- name: setup
id: setup-dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: "8.0.300"
45 changes: 45 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: ci

on:
push:
branches:
- main
pull_request:

jobs:

build:
runs-on: ubuntu-latest
steps:
- name: setup dotnet
uses: ./.github/dotnet
- uses: actions/checkout@v2
- name: Run dotnet build
run: dotnet build --configuration Debug

fmt:
runs-on: ubuntu-latest
steps:
- name: setup dotnet
uses: ./.github/dotnet
- uses: actions/checkout@v2
- name: dotnet format check
run: dotnet format --verify-no-changes *.sln
env:
PATH: ${{ github.env.PATH }}:/home/runner/.dotnet/tools

unit-test:
runs-on: ubuntu-latest
steps:
- name: setup dotnet
uses: ./.github/dotnet
- uses: actions/checkout@v2
- name: unit test
run: dotnet test *sln

image-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build . --file Dockerfile --tag yurvon-screamo/redfish.mockup.server:$(date +%s)
13 changes: 6 additions & 7 deletions .github/workflows/docker-image-release.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
name: Build and Push Docker Image
name: Publish release

on:
release:
push:
branches: [ "main" ]
types: [published]

jobs:
build:
runs-on: ubuntu-latest

steps:

- name: Checkout code
uses: actions/checkout@v3

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
Expand All @@ -21,7 +20,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build Docker image
run: docker build . -t ghcr.io/yurvon-screamo/redfish-mockup-server:latest
run: docker build . -t ghcr.io/yurvon-screamo/redfish-mockup-server:${{ github.event.release.tag_name }}

- name: Push Docker image
run: env
run: docker push ghcr.io/yurvon-screamo/redfish-mockup-server:${{ github.event.release.tag_name }}
16 changes: 0 additions & 16 deletions .github/workflows/docker-image.yml

This file was deleted.

0 comments on commit 9f9fabc

Please sign in to comment.