Skip to content

Commit

Permalink
ci: move docker jobs to other file
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippvK committed Aug 4, 2024
1 parent a785c44 commit 20af5f6
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 18 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,3 @@ jobs:
run: sudo apt-get install -y genisoimage
- name: Build with Maven
run: mvn -B install --file pom.xml
- name: Login to DockerHub
uses: docker/login-action@v2
if: ${{ github.repository == 'philippvk/playforia-minigolf' && github.ref == 'refs/heads/master' && github.event_name == 'push' }}
with:
registry: ${{ secrets.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Docker image
uses: docker/build-push-action@v5
with:
tags: playforia-minigolf:latest
- name: Push Docker image
uses: docker/build-push-action@v5
if: ${{ github.repository == 'philippvk/playforia-minigolf' && github.ref == 'refs/heads/master' && github.event_name == 'push' }}
with:
push: true
tags: ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_NAMESPACE }}/playforia-minigolf:latest

34 changes: 34 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
on:
pull_request:
branches:
- master
push:
branches:
- master

name: Test build

jobs:
build:
name: Build docker image
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Login to DockerHub
uses: docker/login-action@v2
if: ${{ github.repository == 'philippvk/playforia-minigolf' && github.ref == 'refs/heads/master' && github.event_name == 'push' }}
with:
registry: ${{ secrets.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Docker image
uses: docker/build-push-action@v5
with:
tags: playforia-minigolf:latest
- name: Push Docker image
uses: docker/build-push-action@v5
if: ${{ github.repository == 'philippvk/playforia-minigolf' && github.ref == 'refs/heads/master' && github.event_name == 'push' }}
with:
push: true
tags: ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_NAMESPACE }}/playforia-minigolf:latest

0 comments on commit 20af5f6

Please sign in to comment.