82e0ef17e9
ASP.NET AJAX / build_web_app (push) Waiting to run
Angular / build_angular (push) Waiting to run
ASP.NET Core (with Reporting) / build_windows (push) Waiting to run
Blazor (with Reporting) / build_windows (push) Waiting to run
Blazor (with Reporting) / build_linux (push) Waiting to run
Console (.NET) / build_console (arm64, linux) (push) Waiting to run
Console (.NET) / build_console (arm64, win) (push) Waiting to run
Console (.NET) / build_console (x64, linux) (push) Waiting to run
Console (.NET) / build_console (x64, win) (push) Waiting to run
MAUI / Windows Smoketest (push) Waiting to run
MAUI / Android Smoketest (push) Waiting to run
MAUI / iOS Smoketest (push) Waiting to run
MAUI / MacCatalyst Smoketest (push) Waiting to run
WinForms (.NET Framework) / build_desktop (Release, x64) (push) Waiting to run
WinForms (.NET Framework) / build_desktop (Release, x86) (push) Waiting to run
WinUI3 / build-windows (push) Waiting to run
WPF (.NET Framework) / build_desktop (Release, x64) (push) Waiting to run
WPF (.NET Framework) / build_desktop (Release, x86) (push) Waiting to run
ASP.NET Core (with Reporting) - Docker / Microsoft Base - Publish to Docker Hub (push) Waiting to run
ASP.NET Core (with Reporting) - Docker / CentOS Base - Publish to Docker Hub (push) Waiting to run
Blazor (with Reporting) - Docker / Dockerfile Build and Publish (push) Waiting to run
214 lines
7.5 KiB
YAML
214 lines
7.5 KiB
YAML
name: Blazor (with Reporting) - Docker
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- 'src/Blazor/**/*'
|
|
|
|
env:
|
|
DOTNET_VERSION: "10.0.x"
|
|
BLAZOR_PROJ_PATH: src/Blazor/MyBlazorApp/MyBlazorApp.csproj
|
|
NUGET_CONFIG_PATH: src/NuGet.Config
|
|
CONTAINER_REPOSITORY: "lancemccarthy/myblazorapp"
|
|
|
|
# For ghcr.io access
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
jobs:
|
|
#################### Example 1 ##########################
|
|
# Dockerfile build and publish to Docker Hub
|
|
# - Webook to automatically redeploy stack in Portainer
|
|
#########################################################
|
|
dockerfile_to_dockerhub:
|
|
name: "Dockerfile Build and Publish"
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
CONTAINER_REGISTRY: "docker.io"
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Generate tag version
|
|
id: tag-creator
|
|
run: |
|
|
buildDay=`date +%Y.%m.%d`
|
|
tags="$buildDay.$GITHUB_RUN_NUMBER"
|
|
echo "VERSION_TAG=$tags" >> $GITHUB_OUTPUT
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Get package metadata from Docker Hub
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{env.CONTAINER_REGISTRY}}/${{env.CONTAINER_REPOSITORY}}
|
|
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{secrets.DOCKER_HUB_USERNAME}}
|
|
password: ${{secrets.DOCKER_HUB_PAT}}
|
|
|
|
- name: Build and Publish arm64, amd64 Container Images
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: src/Blazor/MyBlazorApp
|
|
platforms: linux/arm64,linux/amd64
|
|
push: true
|
|
secrets: |
|
|
telerik-nuget-key=${{secrets.TELERIK_NUGET_KEY}}
|
|
telerik-license-key=${{secrets.TELERIK_LICENSE_KEY}}
|
|
tags: ${{steps.meta.outputs.tags}}
|
|
|
|
# Required because actions/delete-package-versions@v5 does not work with Docker Hub
|
|
- name: Delete old (untagged) images
|
|
run: |
|
|
IMAGE_TAGS=$(curl -s "https://hub.docker.com/v2/repositories/${{env.CONTAINER_REPOSITORY}}/tags/?page_size=100" | jq -r '.results|.[]|.name')
|
|
for TAGG in $IMAGE_TAGS; do
|
|
if [[ "$TAGG" == "null" ]]; then
|
|
docker rmi "${{env.CONTAINER_REPOSITORY}}:$TAGG"
|
|
curl -s -X DELETE "https://hub.docker.com/v2/repositories/${{env.CONTAINER_REPOSITORY}}/tags/$TAGG/"
|
|
fi
|
|
done
|
|
|
|
- name: Trigger Portainer to pull images and redeploy the stack
|
|
run: curl -X POST ${{secrets.PORTAINER_WEBHOOK_BLAZOR}}
|
|
|
|
|
|
#################### Example 2 ##########################
|
|
# .NET SDK build and publish to ghcr.io
|
|
############################################################
|
|
|
|
# # 2.1 - Build the lancemccarthy/myblazorapp:latest-x64 image
|
|
# build_x64:
|
|
# runs-on: ubuntu-latest
|
|
# name: "[NET SDK] Create x64 image"
|
|
# outputs:
|
|
# build_tag: ${{steps.build.outputs.build_tag}}
|
|
# env:
|
|
# target_arch: "x64"
|
|
# CONTAINER_REGISTRY: "ghcr.io"
|
|
# CONTAINER_BASE_IMAGE: "docker.io/lancemccarthy/skia-aspnet:10.0"
|
|
# steps:
|
|
# - name: Checkout
|
|
# uses: actions/checkout@v6
|
|
# with:
|
|
# fetch-depth: 0
|
|
|
|
# - name: Setup .NET Core SDK
|
|
# uses: actions/setup-dotnet@v4
|
|
# with:
|
|
# dotnet-version: ${{env.DOTNET_VERSION}}
|
|
|
|
# # Needed because dotnet publish -t:PublishContainer uses the CLI (not docker/login-action@v3)
|
|
# - name: Login to ghcr.io
|
|
# run: docker login ${{env.CONTAINER_REGISTRY}} -u ${{github.actor}} -p ${{secrets.GITHUB_TOKEN}}
|
|
|
|
# - name: Restore NuGet Packages
|
|
# run: dotnet restore ${{env.BLAZOR_PROJ_PATH}} -r "linux-${{env.target_arch}}"
|
|
# env:
|
|
# TELERIK_USERNAME: "api-key"
|
|
# TELERIK_PASSWORD: ${{secrets.TELERIK_NUGET_KEY}}
|
|
|
|
# - name: build the x64 image
|
|
# id: build
|
|
# run: |
|
|
# TAG="latest-${{env.target_arch}}"
|
|
# dotnet publish ${{env.BLAZOR_PROJ_PATH}} \
|
|
# -t:PublishContainer \
|
|
# -p PublishProfile=DefaultContainer \
|
|
# -p ContainerBaseImage=${{env.CONTAINER_BASE_IMAGE}} \
|
|
# -p ContainerRegistry="${{env.CONTAINER_REGISTRY}}" \
|
|
# -p ContainerRepository="${{env.CONTAINER_REPOSITORY}}" \
|
|
# -p ContainerImageTag="$TAG" \
|
|
# --arch ${{env.target_arch}} \
|
|
# --no-restore
|
|
# echo "build_tag=$TAG" >> $GITHUB_OUTPUT
|
|
# env:
|
|
# TELERIK_LICENSE: ${{secrets.TELERIK_LICENSE_KEY}}
|
|
|
|
# # Builds the lancemccarthy/myblazorapp:latest-arm64 image
|
|
# build_arm64:
|
|
# name: "[NET SDK] Create arm64 image"
|
|
# runs-on: ubuntu-latest
|
|
# outputs:
|
|
# build_tag: ${{steps.build.outputs.build_tag}}
|
|
# env:
|
|
# target_arch: "arm64"
|
|
# CONTAINER_REGISTRY: "ghcr.io"
|
|
# CONTAINER_BASE_IMAGE: "docker.io/lancemccarthy/skia-aspnet:10.0"
|
|
# steps:
|
|
# - name: Checkout
|
|
# uses: actions/checkout@v4
|
|
# with:
|
|
# fetch-depth: 0
|
|
|
|
# - name: Setup .NET Core SDK
|
|
# uses: actions/setup-dotnet@v4
|
|
# with:
|
|
# dotnet-version: ${{env.DOTNET_VERSION}}
|
|
|
|
# # Needed because dotnet publish -t:PublishContainer uses the CLI (not docker/login-action@v3)
|
|
# - name: Login to ghcr.io
|
|
# run: docker login ${{env.CONTAINER_REGISTRY}} -u ${{github.actor}} -p ${{secrets.GITHUB_TOKEN}}
|
|
|
|
# - name: Restore NuGet Packages
|
|
# run: dotnet restore ${{env.BLAZOR_PROJ_PATH}} -r "linux-${{env.target_arch}}"
|
|
# env:
|
|
# TELERIK_USERNAME: "api-key"
|
|
# TELERIK_PASSWORD: ${{secrets.TELERIK_NUGET_KEY}}
|
|
|
|
# - name: build the arm64 image
|
|
# id: build
|
|
# run: |
|
|
# TAG="latest-${{env.target_arch}}"
|
|
# dotnet publish ${{env.BLAZOR_PROJ_PATH}} \
|
|
# -t:PublishContainer \
|
|
# -p PublishProfile=DefaultContainer \
|
|
# -p ContainerBaseImage=${{env.CONTAINER_BASE_IMAGE}} \
|
|
# -p ContainerRegistry="${{env.CONTAINER_REGISTRY}}" \
|
|
# -p ContainerRepository="${{env.CONTAINER_REPOSITORY}}" \
|
|
# -p ContainerImageTag="$TAG" \
|
|
# --arch ${{env.target_arch}} \
|
|
# --no-restore
|
|
# echo "build_tag=$TAG" >> $GITHUB_OUTPUT
|
|
# env:
|
|
# TELERIK_LICENSE: ${{secrets.TELERIK_LICENSE_KEY}}
|
|
|
|
# # Create a manifest to combine both images into a single "lancemccarthy/myblazorapp:latest" tag
|
|
# publish_combined_manifest:
|
|
# runs-on: ubuntu-latest
|
|
# name: "[NET SDK] Publish multi-arch manifest"
|
|
# needs: [build_x64, build_arm64]
|
|
# env:
|
|
# CONTAINER_REGISTRY: "ghcr.io"
|
|
# steps:
|
|
# - name: Checkout
|
|
# uses: actions/checkout@v4
|
|
|
|
# - name: Login to ghcr.io
|
|
# run: docker login ${{env.CONTAINER_REGISTRY}} -u ${{github.actor}} -p ${{secrets.GITHUB_TOKEN}}
|
|
|
|
# - name: Create multi-arch manifest
|
|
# run: docker manifest create "${{env.CONTAINER_REPOSITORY}}:latest" "${{env.CONTAINER_REPOSITORY}}:${{needs.build_x64.outputs.build_tag}}" "${{env.CONTAINER_REPOSITORY}}:${{needs.build_arm64.outputs.build_tag}}"
|
|
|
|
# - name: Push multi-arch manifest
|
|
# run: docker manifest push "${{env.CONTAINER_REPOSITORY}}:latest"
|
|
|
|
# - name: Delete old images
|
|
# uses: actions/delete-package-versions@v5
|
|
# with:
|
|
# package-name: "myblazorapp"
|
|
# package-type: container
|
|
# min-versions-to-keep: 2
|
|
# token: ${{secrets.GITHUB_TOKEN}}
|