Skip to content

Commit

Permalink
Create a Docker Image per commit
Browse files Browse the repository at this point in the history
  • Loading branch information
OoLunar committed Feb 5, 2024
1 parent 1845e33 commit c6c5ad5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 28 deletions.
46 changes: 25 additions & 21 deletions .github/workflows/build-commit.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@
name: Publish Docker Image
on:
push:
branches:
- main
paths:
- ".github/workflows/build-commit.yml"
- "src/**"
- "NotifierRedirecter.sln"
- "Dockerfile"

env:
DOTNET_NOLOGO: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: 1
- master
workflow_dispatch:

jobs:
build-commit:
name: "Build Commit ${{ github.sha }}"
name: Build Commit
runs-on: ubuntu-latest
if: "!contains(format('{0} {1}', github.event.head_commit.message, github.event.pull_request.title), '[ci-skip]')"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
- name: Generate Date Tag
run: echo "TAG=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push
uses: docker/build-push-action@v2
with:
dotnet-version: 8
- name: Build Project
run: "dotnet build"
- name: Build Dockerfile
run: "docker build -t notifier-redirecter:latest ."
context: .
file: ./Dockerfile
push: true
build-args: VERSION=${{ env.TAG }}
tags: |
ghcr.io/kuylar/dspassistant:latest
ghcr.io/kuylar/dspassistant:${{ env.TAG }}
7 changes: 0 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,11 @@ on:
push:
branches:
- master
workflow_dispatch:
inputs:
tag:
description: 'Tag'
required: true
default: 'latest'

jobs:
push-to-registery:
name: Publish Docker Image
runs-on: ubuntu-latest
if: "!contains(format('{0} {1}', github.event.head_commit.message, github.event.pull_request.title), '[ci-skip]')"
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down

0 comments on commit c6c5ad5

Please sign in to comment.