Skip to content

Sets building and publishing images in CI to run when sdk version changes. Updates to .NET 8.0. #104

Sets building and publishing images in CI to run when sdk version changes. Updates to .NET 8.0.

Sets building and publishing images in CI to run when sdk version changes. Updates to .NET 8.0. #104

Workflow file for this run

# ------------------------------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------------------------------
name: build-snapshot
on:
push:
branches:
- master
paths:
- 'snapshot/**'
- '.github/workflows/snapshot.yml'
- '.github/workflows/dapr-deploy.yml'
- 'Directory.Packages.props'
pull_request:
branches:
- master
paths:
- 'snapshot/**'
- 'Directory.Packages.props'
jobs:
build:
name: build snapshot
runs-on: ubuntu-latest
env:
APP_REGISTRY: daprtests.azurecr.io
APP_IMAGE_NAME: snapshot
# TODO: APP_VER needs to be versioned correctly
APP_VER: dev
APP_DIR: ./snapshot
ARTIFACT_DIR: ./deploy_artifact
steps:
- name: Check out code
uses: actions/checkout@v2
- name: docker login
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ${{ secrets.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_REGISTRY_ID }}
password: ${{ secrets.DOCKER_REGISTRY_PASS }}
- name: Build hashtag app docker image
run: |
docker compose build ${{ env.APP_IMAGE_NAME }}
docker tag ${{ env.APP_IMAGE_NAME }} ${{ env.APP_REGISTRY }}/${{ env.APP_IMAGE_NAME }}:${{ env.APP_VER }}
- name: Push hashtag app image to dockerhub
if: github.event_name != 'pull_request'
run: |
docker push ${{ env.APP_REGISTRY }}/${{ env.APP_IMAGE_NAME }}:${{ env.APP_VER }}
- name: Copy deployment yaml to archieve
run: |
mkdir -p ${{ env.ARTIFACT_DIR }}
cp ./longhaul-test/*.yml ${{ env.ARTIFACT_DIR }}
- name: Upload artifacts
uses: actions/upload-artifact@master
with:
name: longhaul-test
path: ${{ env.ARTIFACT_DIR }}
deploy:
name: deploy snapshot to test cluster
needs: build
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
env:
APP_NAMESPACE: longhaul-test
TEST_CLUSTER_NAME: aks-longhaul-release
TEST_RESOURCE_GROUP: aks-longhaul-release
ARTIFACT_DIR: ./deploy_artifact
steps:
- name: download artifacts
uses: actions/download-artifact@master
with:
name: longhaul-test
path: ${{ env.ARTIFACT_DIR }}
- name: Login Azure
run: |
az login --service-principal -u ${{ secrets.AZURE_LOGIN_USER }} -p ${{ secrets.AZURE_LOGIN_PASS }} --tenant ${{ secrets.AZURE_TENANT }} --output none
- name: Set up kubeconf for longhaul test environment
run: |
az aks get-credentials -n ${{ env.TEST_CLUSTER_NAME }} -g ${{ env.TEST_RESOURCE_GROUP }}
- name: Deploy apps to longhaul test environment
run: |
kubectl apply -n ${{ env.APP_NAMESPACE }} -f ${{ env.ARTIFACT_DIR }}/snapshot-deploy.yml & kubectl rollout restart -n ${{ env.APP_NAMESPACE }} deploy/snapshot-app