improve prompt #33
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 ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.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 a Build Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: HomeAutomation-Web-linux-x64 | |
path: ./output/HomeAutomation-Web-linux-x64 | |
- name: Upload a Build Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: HomeAutomation-Web-linux-arm64 | |
path: ./output/HomeAutomation-Web-linux-arm64 | |
- name: Upload a Build Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: HomeAutomation-Web-linux-arm | |
path: ./output/HomeAutomation-Web-linux-arm | |
- name: Upload a Build Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: HomeAutomation-Web-win-x64 | |
path: ./output/HomeAutomation-Web-win-x64 | |
- name: Push Docker images | |
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 |