mirror of
https://github.com/meysamhadeli/booking-microservices.git
synced 2026-04-28 08:50:23 +08:00
commit
215ef9c3fe
46
.github/actions/docker-build-publish/action.yml
vendored
Normal file
46
.github/actions/docker-build-publish/action.yml
vendored
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
name: "Publish and Build Docker"
|
||||||
|
description: "Publish and Build Docker "
|
||||||
|
|
||||||
|
# Input parameters allow you to specify data that the action expects to use during runtime. GitHub stores input parameters as environment variables.(so they are just string)
|
||||||
|
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputs
|
||||||
|
inputs:
|
||||||
|
tag-name:
|
||||||
|
description: "Tag Name"
|
||||||
|
required: true
|
||||||
|
registry-username:
|
||||||
|
description: "Registry username"
|
||||||
|
required: true
|
||||||
|
registry-password:
|
||||||
|
description: "Registry password"
|
||||||
|
required: true
|
||||||
|
|
||||||
|
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-actions
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
|
||||||
|
##ref: https://docs.docker.com/language/golang/configure-ci-cd/
|
||||||
|
##ref: https://event-driven.io/en/how_to_buid_and_push_docker_image_with_github_actions
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
||||||
|
with:
|
||||||
|
username: ${{ inputs.registry-username }}
|
||||||
|
password: ${{ inputs.registry-password }}
|
||||||
|
|
||||||
|
- name: Build Docker Image
|
||||||
|
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
||||||
|
run: |
|
||||||
|
docker build -t ${{ inputs.registry-username }}/booking-microservices-flight:${{ inputs.tag-name }} -f "${{ github.workspace }}/src/Services/Flight/Dockerfile" .
|
||||||
|
docker build -t ${{ inputs.registry-username }}/booking-microservices-identity:${{ inputs.tag-name }} -f "${{ github.workspace }}/src/Services/Identity/Dockerfile" .
|
||||||
|
docker build -t ${{ inputs.registry-username }}/booking-microservices-passenger:${{ inputs.tag-name }} -f "${{ github.workspace }}/src/Services/Passenger/Dockerfile" .
|
||||||
|
docker build -t ${{ inputs.registry-username }}/booking-microservices-booking:${{ inputs.tag-name }} -f "${{ github.workspace }}/src/Services/Booking/Dockerfile" .
|
||||||
|
|
||||||
|
- name: Publish Docker Image
|
||||||
|
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
||||||
|
run: |
|
||||||
|
docker push ${{ inputs.registry-username }}/booking-microservices-flight:${{ inputs.tag-name }}
|
||||||
|
docker push ${{ inputs.registry-username }}/booking-microservices-identity:${{ inputs.tag-name }}
|
||||||
|
docker push ${{ inputs.registry-username }}/booking-microservices-passenger:${{ inputs.tag-name }}
|
||||||
|
docker push ${{ inputs.registry-username }}/booking-microservices-booking:${{ inputs.tag-name }}
|
||||||
|
|
||||||
29
.github/workflows/ci.yml
vendored
29
.github/workflows/ci.yml
vendored
@ -45,28 +45,11 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
##ref: https://docs.docker.com/language/golang/configure-ci-cd/
|
|
||||||
##ref: https://event-driven.io/en/how_to_buid_and_push_docker_image_with_github_actions
|
- name: Call Composite Action docker-build-publish
|
||||||
- name: Login to DockerHub
|
uses: ./.github/actions/docker-build-publish
|
||||||
uses: docker/login-action@v2
|
|
||||||
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
tag-name: ${{ steps.last_release.outputs.tag_name }}
|
||||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
registry-password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||||
- name: Build Docker Image
|
|
||||||
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
|
||||||
run: |
|
|
||||||
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/booking-microservices-flight:${{ steps.last_release.outputs.tag_name }} -f "${{ github.workspace }}/src/Services/Flight/Dockerfile" .
|
|
||||||
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/booking-microservices-identity:${{ steps.last_release.outputs.tag_name }} -f "${{ github.workspace }}/src/Services/Identity/Dockerfile" .
|
|
||||||
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/booking-microservices-passenger:${{ steps.last_release.outputs.tag_name }} -f "${{ github.workspace }}/src/Services/Passenger/Dockerfile" .
|
|
||||||
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/booking-microservices-booking:${{ steps.last_release.outputs.tag_name }} -f "${{ github.workspace }}/src/Services/Booking/Dockerfile" .
|
|
||||||
|
|
||||||
- name: Publish Docker Image
|
|
||||||
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
|
||||||
run: |
|
|
||||||
docker push ${{ secrets.DOCKERHUB_USERNAME }}/booking-microservices-flight:${{ steps.last_release.outputs.tag_name }}
|
|
||||||
docker push ${{ secrets.DOCKERHUB_USERNAME }}/booking-microservices-identity:${{ steps.last_release.outputs.tag_name }}
|
|
||||||
docker push ${{ secrets.DOCKERHUB_USERNAME }}/booking-microservices-passenger:${{ steps.last_release.outputs.tag_name }}
|
|
||||||
docker push ${{ secrets.DOCKERHUB_USERNAME }}/booking-microservices-booking:${{ steps.last_release.outputs.tag_name }}
|
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: release-drafter/release-drafter@v5
|
- uses: release-drafter/release-drafter@v5
|
||||||
with:
|
with:
|
||||||
config-name: release-drafter.yml
|
config-name: release-drafter-template.yml
|
||||||
disable-releaser: true # only run auto-labeler for PRs
|
disable-releaser: true # only run auto-labeler for PRs
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user