Skip to content

Polish CI pipelines for building/testing and testing environments (#19) #1

Polish CI pipelines for building/testing and testing environments (#19)

Polish CI pipelines for building/testing and testing environments (#19) #1

name: Quetzalcoatl - Build Docker image and publish to GitHub Packages
on:
push:
tags:
- "v*.*.*"
# branches:
# - develop
paths:
- "quetzalcoatl-auth/**"
- ".github/workflows/quetzalcoatl-auth-cd.yaml"
# pull_request:
# branches:
# - develop
#
# paths:
# - "quetzalcoatl-auth/**"
# - ".github/workflows/quetzalcoatl-auth-cd.yaml"
env:
REGISTRY: ghcr.io
IMAGE_NAME: quetzalcoatl-auth
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: quetzalcoatl-auth
steps:
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '7.0.x'
- name: Build
run: |
dotnet restore "Bootstrapper/Bootstrapper.csproj"
dotnet restore "Tests.Integration/Tests.Integration.csproj"
dotnet build --no-restore
- name: Test
run: dotnet test -e ASPNETCORE_ENVIRONMENT=Testing "Tests.Integration/Tests.Integration.csproj"
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: quetzalcoatl-auth
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}