From 50bde3086b9cd9ac7acc6cfc9fcee3acb2e4e7f0 Mon Sep 17 00:00:00 2001 From: caspermortensen Date: Wed, 22 Nov 2023 11:06:16 +0100 Subject: [PATCH 1/4] split of workflow --- .github/workflows/ci-cd-pipeline.yml | 33 ++---------------- .github/workflows/deploy-docker-image.yml | 41 +++++++++++++++++++++++ 2 files changed, 43 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/deploy-docker-image.yml diff --git a/.github/workflows/ci-cd-pipeline.yml b/.github/workflows/ci-cd-pipeline.yml index a559c99..12c1f1f 100644 --- a/.github/workflows/ci-cd-pipeline.yml +++ b/.github/workflows/ci-cd-pipeline.yml @@ -1,8 +1,8 @@ -name: ci-cd-pipeline +name: test-and-build on: pull_request: - branches: ["main"] + branches: ["main, **"] #delete ** workflow_dispatch: env: @@ -60,32 +60,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 }} diff --git a/.github/workflows/deploy-docker-image.yml b/.github/workflows/deploy-docker-image.yml new file mode 100644 index 0000000..c6789e4 --- /dev/null +++ b/.github/workflows/deploy-docker-image.yml @@ -0,0 +1,41 @@ +name: build-and-deploy-docker image + +on: + push: + branches: ["main", "**"] #delete ** + workflow_dispatch: + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: ghcr.io + # github.repository as / + 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 }} From d7c4fdf9d15e84463e65597a43fee00253d4c978 Mon Sep 17 00:00:00 2001 From: caspermortensen Date: Wed, 22 Nov 2023 11:16:21 +0100 Subject: [PATCH 2/4] fix name --- .github/workflows/deploy-docker-image.yml | 2 +- .github/workflows/{ci-cd-pipeline.yml => test-and-buil.yml} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{ci-cd-pipeline.yml => test-and-buil.yml} (100%) diff --git a/.github/workflows/deploy-docker-image.yml b/.github/workflows/deploy-docker-image.yml index c6789e4..2c7ffd1 100644 --- a/.github/workflows/deploy-docker-image.yml +++ b/.github/workflows/deploy-docker-image.yml @@ -2,7 +2,7 @@ name: build-and-deploy-docker image on: push: - branches: ["main", "**"] #delete ** + branches: ["main"] workflow_dispatch: env: diff --git a/.github/workflows/ci-cd-pipeline.yml b/.github/workflows/test-and-buil.yml similarity index 100% rename from .github/workflows/ci-cd-pipeline.yml rename to .github/workflows/test-and-buil.yml From e67e445a5c2042cec05f5d5697fefc55fe5b714c Mon Sep 17 00:00:00 2001 From: caspermortensen Date: Wed, 22 Nov 2023 11:18:07 +0100 Subject: [PATCH 3/4] remove workflow dispatch --- .github/workflows/deploy-docker-image.yml | 1 - .github/workflows/test-and-buil.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/deploy-docker-image.yml b/.github/workflows/deploy-docker-image.yml index 2c7ffd1..4e41e76 100644 --- a/.github/workflows/deploy-docker-image.yml +++ b/.github/workflows/deploy-docker-image.yml @@ -3,7 +3,6 @@ name: build-and-deploy-docker image on: push: branches: ["main"] - workflow_dispatch: env: # Use docker.io for Docker Hub if empty diff --git a/.github/workflows/test-and-buil.yml b/.github/workflows/test-and-buil.yml index 12c1f1f..b16b2aa 100644 --- a/.github/workflows/test-and-buil.yml +++ b/.github/workflows/test-and-buil.yml @@ -3,7 +3,6 @@ name: test-and-build on: pull_request: branches: ["main, **"] #delete ** - workflow_dispatch: env: # Use docker.io for Docker Hub if empty From 8fdb543c7d3ca4db10ab23dad248f574de9108fa Mon Sep 17 00:00:00 2001 From: caspermortensen Date: Wed, 22 Nov 2023 11:23:02 +0100 Subject: [PATCH 4/4] fix workflow --- .github/workflows/test-and-buil.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-and-buil.yml b/.github/workflows/test-and-buil.yml index b16b2aa..ea0cd7d 100644 --- a/.github/workflows/test-and-buil.yml +++ b/.github/workflows/test-and-buil.yml @@ -1,8 +1,8 @@ name: test-and-build on: - pull_request: - branches: ["main, **"] #delete ** + push: + branches: ["**"] env: # Use docker.io for Docker Hub if empty