Skip to content

Deploy sln-bookings

Deploy sln-bookings #2

Workflow file for this run

name: 'Deploy sln-bookings'
on:
push:
branches:
- main
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: '${{ github.workflow }} @ ${{ github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
install-build-publish-deploy:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
lfs: true
- name: Restore cached dependencies
uses: actions/cache@v3
with:
path: |
**/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build project
run: yarn build
- name: Login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: |
ghcr.io/stadtlandnetz/sln-notion-room-booking:${{ github.sha }}
ghcr.io/stadtlandnetz/sln-notion-room-booking:main
- name: Deploy
run: |
kubectl config set-cluster k8s --server=${{ secrets.OTC_KUBERNETES_SERVER }}
kubectl config set clusters.k8s.certificate-authority-data ${{ secrets.OTC_KUBERNETES_CERT }}
kubectl config set-credentials gitlab --token=${{ secrets.OTC_KUBERNETES_TOKEN }}
kubectl config set-context default --cluster=k8s --user=gitlab
kubectl config use-context default
kubectl set image deployment/sln-bookings sln-bookings=ghcr.io/stadtlandnetz/sln-notion-room-booking:${{ github.sha }}