From f3f71a14682c2b4039676d054c33422987bba3d8 Mon Sep 17 00:00:00 2001 From: meysamhadeli Date: Tue, 24 Jan 2023 22:37:13 +0330 Subject: [PATCH] . --- .github/workflows/build-publish.yml | 43 --------------------------- .github/workflows/github-packages.yml | 40 +++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 43 deletions(-) delete mode 100644 .github/workflows/build-publish.yml create mode 100644 .github/workflows/github-packages.yml diff --git a/.github/workflows/build-publish.yml b/.github/workflows/build-publish.yml deleted file mode 100644 index d68f058..0000000 --- a/.github/workflows/build-publish.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: build-publish - -on: - # run it on push to the default repository branch - push: - branches: [ develop ] - # run it during pull request - pull_request: - -jobs: - # define job to build and publish docker image - build-and-push-docker-image: - name: Build Docker image and push to repositories - # run only when code is compiling and tests are passing - runs-on: ubuntu-latest - - # steps to perform in job - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PASSWORD }} - - - name: Login to Github Packages - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build image - run: | - docker build -t meysamh66/${{ github.repository }}/flight:latest -f "${{ github.workspace }}/src/Services/Flight/Dockerfile" . - - - name: Publish image - run: | - docker push meysamh66/${{ github.repository }}/flight:latest - - diff --git a/.github/workflows/github-packages.yml b/.github/workflows/github-packages.yml new file mode 100644 index 0000000..2d0f9d5 --- /dev/null +++ b/.github/workflows/github-packages.yml @@ -0,0 +1,40 @@ +name: github-packages + +on: + push: + branches: [ develop ] + pull_request: + +jobs: + + build-and-push-docker-image: + name: Build and Publish Docker image to Github Packages + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + + - name: Login to Github Packages + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build image + run: | + docker build -t ghcr.io/${{ github.repository }}/flight:latest -f "${{ github.workspace }}/src/Services/Flight/Dockerfile" . + docker build -t ghcr.io/${{ github.repository }}/identity:latest -f "${{ github.workspace }}/src/Services/Identity/Dockerfile" . + docker build -t ghcr.io/${{ github.repository }}/passenger:latest -f "${{ github.workspace }}/src/Services/Passenger/Dockerfile" . + docker build -t ghcr.io/${{ github.repository }}/booking:latest -f "${{ github.workspace }}/src/Services/Booking/Dockerfile" . + + - name: Publish image + run: | + docker push ghcr.io/${{ github.repository }}/flight:latest + docker push ghcr.io/${{ github.repository }}/identity:latest + docker push ghcr.io/${{ github.repository }}/passenger:latest + docker push ghcr.io/${{ github.repository }}/booking:latest + +