Skip to content

Commit

Permalink
Merge pull request #8 from Knox-AAU/split-workflow-pullrequest_push
Browse files Browse the repository at this point in the history
Split workflow pullrequest push
  • Loading branch information
AsbjoernJC authored Nov 22, 2023
2 parents f4ceba0 + 8fdb543 commit 83996a8
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 33 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/deploy-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: build-and-deploy-docker image

on:
push:
branches: ["main"]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}

jobs:
docker_build_and_deploy_image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v3
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: ./
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: ci-cd-pipeline
name: test-and-build

on:
pull_request:
branches: ["main"]
workflow_dispatch:
push:
branches: ["**"]

env:
# Use docker.io for Docker Hub if empty
Expand Down Expand Up @@ -60,32 +59,3 @@ jobs:
echo "Building projects"
python3 relation_extraction/main.py
python3 concept_linking/main.py
docker_build_and_deploy_image:
runs-on: ubuntu-latest
needs: build
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v3
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: ./
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 83996a8

Please sign in to comment.