Update dependency Microsoft.VisualStudio.Azure.Containers.Tools.Targe… #102
Workflow file for this run
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: 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@3951f0dfe7a07e2313ec93c75700083e2005cbab # 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 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 | |
done | |
- name: Upload Build Artifacts | |
if: github.ref == 'refs/heads/main' || github.event.inputs.publish == 'true' | |
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4 | |
with: | |
name: HomeAutomation-Web-linux-x64 | |
path: ./output/HomeAutomation-Web-linux-x64 | |
- name: Upload Build Artifacts (win-x64) | |
if: github.ref == 'refs/heads/main' || github.event.inputs.publish == 'true' | |
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # 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; do | |
docker tag $app:$arch $DOCKER_USERNAME/$app:latest-$arch | |
done | |
for ver in latest; do | |
echo "Deploying version $ver" | |
for arch in amd64; 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 manifest annotate $DOCKER_USERNAME/$app:$ver $DOCKER_USERNAME/$app:$ver-amd64 --os linux --arch amd64 | |
docker manifest push $DOCKER_USERNAME/$app:$ver | |
done | |
done | |
env: | |
DOCKER_USERNAME: ${{ vars.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
DOCKER_CLI_EXPERIMENTAL: enabled |