Skip to content

Deploy shiny app

Deploy shiny app #11

Workflow file for this run

name: Deploy shiny app
on:
workflow_dispatch:
inputs:
name:
description: "Nom du chart à déployer?"
type: string
required: true
default: test
refreshToken:
description: Refresh token"
type: string
required: true
idToken:
description: Refresh token"
type: string
required: true
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Mask token
run: |
REFRESH_TOKEN=$(jq -r '.inputs.refreshToken' $GITHUB_EVENT_PATH)
echo ::add-mask::$REFRESH_TOKEN
echo REFRESH_TOKEN=$REFRESH_TOKEN >> $GITHUB_ENV
ID_TOKEN=$(jq -r '.inputs.idToken' $GITHUB_EVENT_PATH)
echo ::add-mask::$ID_TOKEN
echo ID_TOKEN=$ID_TOKEN >> $GITHUB_ENV
- uses: actions/checkout@v2
- name: yq - portable yaml processor
uses: mikefarah/[email protected]
- name: Set image name
run: echo "IMAGE_NAME=$(yq '.shiny.image.repository' ./charts/values.yaml)" >> $GITHUB_ENV
- name: Image name
run: |
echo ${{ env.IMAGE_NAME }}
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v3
with:
images: ${{ env.IMAGE_NAME }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: ./app/
file: ./app/Dockerfile
push: true
tags: ${{ env.IMAGE_NAME }}:latest
labels: ${{ steps.docker_meta.outputs.labels }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
deploy:
needs: docker
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.environment_name }}
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: azure/setup-kubectl@v3
with:
version: 'v1.29.1'
id: install_kubectl
- uses: azure/[email protected]
with:
version: '3.14.4'
id: install_helm
- name: Set credentials
run : |
kubectl config set-cluster apiserver.kub.sspcloud.fr \
--server=https://apiserver.kub.sspcloud.fr \
--insecure-skip-tls-verify=true
kubectl config set-credentials ${{ secrets.ONYXIA_USERNAME }} \
--auth-provider=oidc \
--auth-provider-arg=idp-issuer-url=https://auth.lab.sspcloud.fr/auth/realms/sspcloud \
--auth-provider-arg=client-id=onyxia \
--auth-provider-arg=refresh-token=${{ env.REFRESH_TOKEN }} \
--auth-provider-arg=id-token=${{ env.ID_TOKEN }}
kubectl config set-context apiserver.kub.sspcloud.fr \
--user=${{ secrets.ONYXIA_USERNAME }} \
--cluster=apiserver.kub.sspcloud.fr \
--namespace=user-${{ secrets.ONYXIA_USERNAME }}
kubectl config use-context apiserver.kub.sspcloud.fr
- name: "Deploy helm charts"
run : |
helm dependency update ./charts
helm upgrade ${{ github.event.inputs.name }} ./charts --recreate-pods --install