Skip to content

Instantly share code, notes, and snippets.

@lucamilan
Created November 24, 2021 15:30
Show Gist options
  • Select an option

  • Save lucamilan/0c62bc097ae1d0a0f69543cf46f94beb to your computer and use it in GitHub Desktop.

Select an option

Save lucamilan/0c62bc097ae1d0a0f69543cf46f94beb to your computer and use it in GitHub Desktop.
Build and Deploy modern applications with Type
name: Build and Deploy
on:
push:
branches:
- master
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: βœ”οΈ Checkout git repository
uses: actions/checkout@v2
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
- name: 🧰 Setup DotNet 3.1.300 (Tye)
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.300'
- name: 🧰 Setup DotNet 6.0.100 (Project)
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.100'
- name: πŸ› οΈ Install Dotnet Tools
run: |
dotnet tool install -g Microsoft.Tye --version "0.10.0-alpha.21420.1"
dotnet tool install -g nbgv --version "3.4.244"
- name: πŸ› οΈ Build .NET Solution
run: |
dotnet restore
dotnet build
- name: πŸ” Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: πŸš’ Push containers to Docker with Tye
run: |
tye push -v Debug
- name: πŸ–¨οΈ Generate Kubernetes manifests with Microsoft Tye
run: |
tye generate -v Debug -n lucamilan
cat tye-experiments-generate-production.yaml
- name: πŸ₯ Create Okteto kube.config
if: success()
env:
KUBE_CONFIG: ${{ secrets.OKTETO_KUBE_CONFIG }}
run: |
echo $KUBE_CONFIG | base64 -d > kubeconfig
- name: πŸ”₯ Update Kubernetes cluster
if: success()
run: |
kubectl --kubeconfig kubeconfig apply -f kubernetes/redis.yaml,kubernetes/redis-secret.yaml,tye-experiments-generate-production.yaml,kubernetes/ingress.yaml --namespace=lucamilan
kubectl --kubeconfig kubeconfig get pods --namespace=lucamilan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment