Skip to content

update manual deploy #1696

update manual deploy

update manual deploy #1696

name: Test, Build and Push Development Docker Image
on:
push:
branches:
- main
pull_request:
branches:
- main
paths:
- "src/web/Jordnaer/**"
- "src/shared/Jordnaer.Shared/**"
- "tests/web/Jordnaer.Tests/**"
- "tests/web/Jordnaer.E2E.Tests/**"
- "Dockerfile"
- ".github/workflows/container_ci.yml"
- ".github/workflows/website_backend_ci.yml"
env:
TESTS_DIRECTORY: tests/web/Jordnaer.Tests
REGISTRY: ghcr.io
IMAGE_NAME: nielspilgaard/minimoeder-website
jobs:
unit-tests:
if: "!startsWith(github.ref, 'refs/tags/')"
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up dotnet
uses: actions/setup-dotnet@v5
with:
dotnet-version: "10.x"
- name: Test
run: >
dotnet test "${{ env.TESTS_DIRECTORY }}"
--logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true"
--filter Category!=SkipInCi
-p:InformationalVersion=0.0.0-dev+${{ github.sha }}
e2e-tests:
if: "!startsWith(github.ref, 'refs/tags/')"
needs: unit-tests
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up dotnet
uses: actions/setup-dotnet@v5
with:
dotnet-version: "10.x"
- name: Run E2E tests
run: >
dotnet test tests/web/Jordnaer.E2E.Tests
--configuration Release
--logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true"
--filter Category!=SkipInCi
-p:InformationalVersion=0.0.0-dev+${{ github.sha }}
env:
Playwright__Headless: "true"
build-and-push:
# Only build and push the image on pushes to main branch, not tags
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/')
needs: [unit-tests, e2e-tests]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Log in to Container Registry
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v6
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=sha,prefix={{branch}}-
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VERSION=0.0.0-dev+${{ github.sha }}