mirror of
https://github.com/meysamhadeli/booking-microservices.git
synced 2026-04-10 17:59:38 +08:00
91 lines
3.0 KiB
YAML
91 lines
3.0 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ "main" , "develop" ]
|
|
paths-ignore:
|
|
- "README.md"
|
|
pull_request:
|
|
branches: [ "main" , "develop" ]
|
|
paths-ignore:
|
|
- "README.md"
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v2
|
|
with:
|
|
dotnet-version: 7.0.x
|
|
|
|
- name: Cache NuGet Packages
|
|
uses: actions/cache@v3
|
|
with:
|
|
key: ${{ runner.os }}-dotnet-nuget
|
|
path: ~/.nuget/packages
|
|
|
|
|
|
- name: Restore dependencies
|
|
run: dotnet restore
|
|
|
|
- name: Build
|
|
run: dotnet build -c Release --no-restore
|
|
|
|
- name: Test
|
|
run: dotnet test -c Release --no-restore
|
|
|
|
- name: Update Release Drafter
|
|
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
|
id: last_release
|
|
uses: release-drafter/release-drafter@v5
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Release Version Info
|
|
run:
|
|
echo "Release version is:" ${{ steps.last_release.outputs.tag_name }}
|
|
|
|
- name: Build and Publish Identity to Docker
|
|
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
|
uses: ./.github/actions/docker-build-publish
|
|
with:
|
|
tag-name: ${{ steps.last_release.outputs.tag_name }}
|
|
registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
registry-password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
|
dockerfile-path: 'src/Services/Identity/Dockerfile'
|
|
image-name: 'booking-microservices-identity'
|
|
|
|
- name: Build and Publish Flight to Docker
|
|
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
|
uses: ./.github/actions/docker-build-publish
|
|
with:
|
|
tag-name: ${{ steps.last_release.outputs.tag_name }}
|
|
registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
registry-password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
|
dockerfile-path: 'src/Services/Flight/Dockerfile'
|
|
image-name: 'booking-microservices-flight'
|
|
|
|
- name: Build and Publish Passenger to Docker
|
|
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
|
uses: ./.github/actions/docker-build-publish
|
|
with:
|
|
tag-name: ${{ steps.last_release.outputs.tag_name }}
|
|
registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
registry-password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
|
dockerfile-path: 'src/Services/Passenger/Dockerfile'
|
|
image-name: 'booking-microservices-passenger'
|
|
|
|
- name: Build and Publish Booking to Docker
|
|
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
|
uses: ./.github/actions/docker-build-publish
|
|
with:
|
|
tag-name: ${{ steps.last_release.outputs.tag_name }}
|
|
registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
registry-password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
|
dockerfile-path: 'src/Services/Booking/Dockerfile'
|
|
image-name: 'booking-microservices-booking'
|