Update github/codeql-action digest to aa57810 (#82) #144
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: CI | |
on: | |
push: | |
branches: | |
- main | |
- renovate/* | |
tags: | |
- 'v*' | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: {} | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@3e891b0cb619bf60e2c25674b222b8940e2c1c25 # v4 | |
with: | |
dotnet-version: '9.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@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4 | |
with: | |
name: TeslaMateAgile-linux-x64 | |
path: ./output/TeslaMateAgile-linux-x64 | |
- name: Upload a Build Artifact | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4 | |
with: | |
name: TeslaMateAgile-linux-arm64 | |
path: ./output/TeslaMateAgile-linux-arm64 | |
- name: Upload a Build Artifact | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4 | |
with: | |
name: TeslaMateAgile-linux-arm | |
path: ./output/TeslaMateAgile-linux-arm | |
- name: Upload a Build Artifact | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4 | |
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@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8 # v2 | |
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- name: Azure Login | |
uses: Azure/login@a65d910e8af852a8061c627c456678983e180302 # v2 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Login to Kubernetes | |
uses: Azure/aks-set-context@1cf43fa609aaef0617c6a12deda238b920e926b0 # v4 | |
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 |