2024-07-02 15:14:08 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
# generic
|
|
|
|
name: 'Build and Publish'
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2024-07-25 09:33:32 +02:00
|
|
|
- 'main'
|
2024-07-02 15:14:08 +02:00
|
|
|
|
|
|
|
# jobs
|
|
|
|
jobs:
|
|
|
|
|
|
|
|
# build container
|
2024-07-04 16:08:35 +02:00
|
|
|
Build:
|
2024-07-02 15:14:08 +02:00
|
|
|
runs-on: 'ubuntu-latest'
|
|
|
|
steps:
|
2024-09-06 16:36:36 +02:00
|
|
|
|
2024-07-02 15:14:08 +02:00
|
|
|
# checkout code
|
|
|
|
- name: 'Clone repo'
|
|
|
|
uses: 'actions/checkout@v2'
|
|
|
|
|
|
|
|
# login to cr.simoncor.net
|
|
|
|
- name: 'Login to cr.simoncor.net'
|
|
|
|
uses: 'docker/login-action@v2'
|
|
|
|
with:
|
|
|
|
registry: 'cr.simoncor.net'
|
|
|
|
username: ${{ vars.REGISTER_USERNAME }}
|
|
|
|
password: ${{ vars.REGISTER_PASSWORD }}
|
|
|
|
|
|
|
|
# build and publish container
|
|
|
|
- name: 'Build and Publish'
|
2024-09-06 16:38:09 +02:00
|
|
|
uses: 'docker/build-push-action@v6'
|
2024-07-02 15:14:08 +02:00
|
|
|
with:
|
|
|
|
context: '.'
|
|
|
|
file: 'Dockerfile.linux.amd64'
|
|
|
|
push: true
|
2024-09-06 12:13:57 +02:00
|
|
|
tags: 'cr.simoncor.net/siempie/simoncor-net:latest,cr.simoncor.net/siempie/simoncor-net:${{ gitea.sha }}'
|
2024-09-06 16:36:36 +02:00
|
|
|
cache-from: '/tmp/cache-folder'
|
2024-07-02 15:14:08 +02:00
|
|
|
|
|
|
|
|
2024-09-06 13:45:38 +02:00
|
|
|
# kubernetes deployment
|
2024-07-04 16:08:35 +02:00
|
|
|
Deployment:
|
2024-07-02 15:14:08 +02:00
|
|
|
runs-on: 'ubuntu-latest'
|
2024-08-26 17:40:47 +02:00
|
|
|
needs: "Build"
|
2024-07-02 15:14:08 +02:00
|
|
|
steps:
|
|
|
|
|
|
|
|
# name: Build
|
2024-09-06 13:45:38 +02:00
|
|
|
- name: 'Kubernetes deployment'
|
2024-07-02 15:14:08 +02:00
|
|
|
uses: 'appleboy/ssh-action@v1.0.3'
|
|
|
|
with:
|
|
|
|
|
2024-07-02 15:26:59 +02:00
|
|
|
# bastion
|
2024-09-06 12:12:50 +02:00
|
|
|
proxy_host: 'wireguard.do.siempie.com'
|
2024-07-02 15:14:08 +02:00
|
|
|
proxy_port: '22'
|
|
|
|
proxy_username: ${{ secrets.USERNAME }}
|
|
|
|
proxy_key: ${{ secrets.SSHKEY }}
|
|
|
|
|
2024-09-06 13:45:38 +02:00
|
|
|
# kubernetes management
|
2024-09-06 12:12:50 +02:00
|
|
|
host: 'mgmt01.infra.vpn.mirahsimon.us'
|
2024-07-02 15:14:08 +02:00
|
|
|
port: '22'
|
|
|
|
username: ${{ secrets.USERNAME }}
|
|
|
|
key: ${{ secrets.SSHKEY }}
|
|
|
|
|
|
|
|
# command
|
2024-07-02 15:21:40 +02:00
|
|
|
script: |
|
2024-09-06 12:51:30 +02:00
|
|
|
sudo -u simon kubectl apply -f /home/simon/Documents/kaas-simoncor-net/manifests
|
2024-09-06 13:51:33 +02:00
|
|
|
sudo -u simon kubectl rollout restart --namespace=simoncor-net deployment simoncor-net
|