Skip to content

Update actions/setup-dotnet digest to 87b7050 #73

Update actions/setup-dotnet digest to 87b7050

Update actions/setup-dotnet digest to 87b7050 #73

Workflow file for this run

name: Build
on:
push:
branches:
- main
- renovate/*
pull_request:
branches: [ main ]
workflow_dispatch:
inputs:
publish:
description: Publish
type: boolean
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@87b7050bc53ea08284295505d98d2aa94301e852 # v4
with:
dotnet-version: '9.0.x'
- name: Build project
run: |
dotnet publish ./HomeAutomation.Web/HomeAutomation.Web.csproj --self-contained true --runtime linux-x64 --output ./output/HomeAutomation-Web-linux-x64
dotnet publish ./HomeAutomation.Web/HomeAutomation.Web.csproj --self-contained true --runtime linux-arm64 --output ./output/HomeAutomation-Web-linux-arm64
dotnet publish ./HomeAutomation.Web/HomeAutomation.Web.csproj --self-contained true --runtime linux-arm --output ./output/HomeAutomation-Web-linux-arm
dotnet publish ./HomeAutomation.Web/HomeAutomation.Web.csproj --self-contained true --runtime win-x64 --output ./output/HomeAutomation-Web-win-x64
- name: Build Docker images
run: |
for appname in HomeAutomation.Web; do
app=`echo $appname | tr '[:upper:]' '[:lower:]'`
echo "Building $appname docker amd64"
docker build -t $app:amd64 -f "$appname/Dockerfile" . --build-arg arch=bookworm-slim
echo "Building $appname docker arm32v7"
docker build -t $app:arm32v7 -f "$appname/Dockerfile" . --build-arg arch=bookworm-slim-arm32v7
echo "Building $appname docker arm64v8"
docker build -t $app:arm64v8 -f "$appname/Dockerfile" . --build-arg arch=bookworm-slim-arm64v8
done
- name: Upload Build Artifacts
if: github.ref == 'refs/heads/main' || github.event.inputs.publish == 'true'
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4
with:
name: HomeAutomation-Web-linux-x64
path: ./output/HomeAutomation-Web-linux-x64
- name: Upload Build Artifacts (linux-arm64)
if: github.ref == 'refs/heads/main' || github.event.inputs.publish == 'true'
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4
with:
name: HomeAutomation-Web-linux-arm64
path: ./output/HomeAutomation-Web-linux-arm64
- name: Upload Build Artifacts (linux-arm)
if: github.ref == 'refs/heads/main' || github.event.inputs.publish == 'true'
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4
with:
name: HomeAutomation-Web-linux-arm
path: ./output/HomeAutomation-Web-linux-arm
- name: Upload Build Artifacts (win-x64)
if: github.ref == 'refs/heads/main' || github.event.inputs.publish == 'true'
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4
with:
name: HomeAutomation-Web-win-x64
path: ./output/HomeAutomation-Web-win-x64
- name: Push Docker images
if: github.ref == 'refs/heads/main' || github.event.inputs.publish == 'true'
run: |
echo $DOCKER_PASSWORD | docker login --username $DOCKER_USERNAME --password-stdin
for appname in HomeAutomation.Web; do
app=`echo $appname | tr '[:upper:]' '[:lower:]'`
echo "Deploying $appname"
for arch in amd64 arm32v7 arm64v8; do
docker tag $app:$arch $DOCKER_USERNAME/$app:latest-$arch
done
for ver in latest; do
echo "Deploying version $ver"
for arch in amd64 arm32v7 arm64v8; do
echo "Pushing docker tag $ver-arch"
docker push $DOCKER_USERNAME/$app:$ver-$arch
done
docker manifest create $DOCKER_USERNAME/$app:$ver $DOCKER_USERNAME/$app:$ver-amd64 $DOCKER_USERNAME/$app:$ver-arm32v7 $DOCKER_USERNAME/$app:$ver-arm64v8
docker manifest annotate $DOCKER_USERNAME/$app:$ver $DOCKER_USERNAME/$app:$ver-amd64 --os linux --arch amd64
docker manifest annotate $DOCKER_USERNAME/$app:$ver $DOCKER_USERNAME/$app:$ver-arm32v7 --os linux --arch arm
docker manifest annotate $DOCKER_USERNAME/$app:$ver $DOCKER_USERNAME/$app:$ver-arm64v8 --os linux --arch arm64
docker manifest push $DOCKER_USERNAME/$app:$ver
done
done
env:
DOCKER_USERNAME: ${{ vars.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_CLI_EXPERIMENTAL: enabled