Skip to content

v1.14.0

v1.14.0 #81

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
tags:
- 'v*'
pull_request:
branches: [ main ]
workflow_dispatch: {}
jobs:
build:
name: 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: Set variables
id: variables
run: |
VERSION=${GITHUB_REF#refs/tags/}
echo VERSION=$VERSION >> $GITHUB_OUTPUT
- name: Test project
run: |
dotnet test ./TeslaMateAgile.Tests/TeslaMateAgile.Tests.csproj
- name: Build project
run: |
dotnet publish ./TeslaMateAgile/TeslaMateAgile.csproj --self-contained true --runtime linux-x64 --output ./output/TeslaMateAgile-linux-x64
dotnet publish ./TeslaMateAgile/TeslaMateAgile.csproj --self-contained true --runtime linux-arm64 --output ./output/TeslaMateAgile-linux-arm64
dotnet publish ./TeslaMateAgile/TeslaMateAgile.csproj --self-contained true --runtime linux-arm --output ./output/TeslaMateAgile-linux-arm
dotnet publish ./TeslaMateAgile/TeslaMateAgile.csproj --self-contained true --runtime win-x64 --output ./output/TeslaMateAgile-win-x64
- name: Build Docker images
run: |
for appname in TeslaMateAgile; 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-amd64
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: TeslaMateAgile-linux-x64
path: ./output/TeslaMateAgile-linux-x64
- name: Upload a Build Artifact
uses: actions/upload-artifact@v3
with:
name: TeslaMateAgile-linux-arm64
path: ./output/TeslaMateAgile-linux-arm64
- name: Upload a Build Artifact
uses: actions/upload-artifact@v3
with:
name: TeslaMateAgile-linux-arm
path: ./output/TeslaMateAgile-linux-arm
- name: Upload a Build Artifact
uses: actions/upload-artifact@v3
with:
name: TeslaMateAgile-win-x64
path: ./output/TeslaMateAgile-win-x64
- name: Push Docker images
run: |
echo $DOCKER_PASSWORD | docker login --username $DOCKER_USERNAME --password-stdin
for appname in TeslaMateAgile; 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
docker tag $app:$arch $DOCKER_USERNAME/$app:$VERSION-$arch
done
versions=($VERSION)
if [[ $VERSION =~ "-" ]]; then
echo "Pre-release version detected, not setting latest tag"
else
versions+=("latest")
echo "Adding latest tag"
fi
for ver in "${versions[@]}"; 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
VERSION: ${{ steps.variables.outputs.VERSION }}
if: startsWith(github.ref, 'refs/tags/')
- name: Zip project
run: |
cd ./output/TeslaMateAgile-linux-x64
zip -r ../TeslaMateAgile-linux-x64.zip .
cd ../TeslaMateAgile-linux-arm64
zip -r ../TeslaMateAgile-linux-arm64.zip .
cd ../TeslaMateAgile-linux-arm
zip -r ../TeslaMateAgile-linux-arm.zip .
cd ../TeslaMateAgile-win-x64
zip -r ../TeslaMateAgile-win-x64.zip .
cd ../../
if: startsWith(github.ref, 'refs/tags/')
- name: Create Release
uses: softprops/action-gh-release@v1
with:
name: Release ${{ github.ref_name }}
draft: true
prerelease: false
files: output/*.zip
if: startsWith(github.ref, 'refs/tags/')
deploy:
if: github.event_name != 'pull_request'
name: Deploy
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v3
- name: Azure Login
uses: Azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Login to Kubernetes
uses: Azure/aks-set-context@v3
with:
resource-group: abyss
cluster-name: abyss
- run: echo "${{ secrets.ABYSS_VALUES_FILE }}" | base64 --decode > abyss.values.yaml
- name: Install TeslaMateAgile
run: |
helm upgrade --install --wait --atomic \
teslamateagile ./charts/teslamateagile \
--namespace default \
--values abyss.values.yaml