67 lines
1.6 KiB
YAML
67 lines
1.6 KiB
YAML
---
|
|
|
|
# generic
|
|
name: 'Build and Publish'
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'main'
|
|
|
|
# jobs
|
|
jobs:
|
|
|
|
# build container
|
|
Build:
|
|
runs-on: 'ubuntu-latest'
|
|
steps:
|
|
|
|
# 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'
|
|
uses: 'docker/build-push-action@v3'
|
|
with:
|
|
context: '.'
|
|
file: 'Dockerfile.linux.amd64'
|
|
push: true
|
|
tags: 'cr.simoncor.net/siempie/simoncor-net:latest,cr.simoncor.net/siempie/simoncor-net:${{ gitea.sha }}'
|
|
|
|
|
|
# kubernetes deployment
|
|
Deployment:
|
|
runs-on: 'ubuntu-latest'
|
|
needs: "Build"
|
|
steps:
|
|
|
|
# name: Build
|
|
- name: 'Kubernetes deployment'
|
|
uses: 'appleboy/ssh-action@v1.0.3'
|
|
with:
|
|
|
|
# bastion
|
|
proxy_host: 'wireguard.do.siempie.com'
|
|
proxy_port: '22'
|
|
proxy_username: ${{ secrets.USERNAME }}
|
|
proxy_key: ${{ secrets.SSHKEY }}
|
|
|
|
# kubernetes management
|
|
host: 'mgmt01.infra.vpn.mirahsimon.us'
|
|
port: '22'
|
|
username: ${{ secrets.USERNAME }}
|
|
key: ${{ secrets.SSHKEY }}
|
|
|
|
# command
|
|
script: |
|
|
sudo -u simon kubectl apply -f /home/simon/Documents/kaas-simoncor-net/manifests
|
|
sudo -u simon kubectl rollout restart --namespace=simoncor-net deployment simoncor-net
|