Order Service Build and Push to GHCR #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Order Service Build and Push to GHCR | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'services/order-service/dotnet/**' | |
workflow_dispatch: | |
env: | |
REGISTRY: ghcr.io | |
REPOSITORY: ${{ github.repository }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set short_sha | |
id: vars | |
run: echo "short_sha=$(git rev-parse --short HEAD)" >> ${GITHUB_ENV} | |
- name: Login to GHCR | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: downcase env.REPOSITORY | |
run: | | |
echo "REPOSITORY=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v2 | |
with: | |
context: services/order-service/dotnet | |
push: true | |
tags: ${{ env.REGISTRY }}/${{ env.REPOSITORY }}/order-service:${{ env.short_sha }} |