start.simoncor.net/.gitea/workflows/build.yaml
Simon Cornet 08a97e9225
All checks were successful
Build and Publish / Build (push) Successful in 11s
Build and Publish / Deployment (push) Successful in 57s
[ci] feat: deploy via bastion.siempie.com
2024-08-26 17:03:04 +02:00

66 lines
1.5 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/start-simoncor-net:latest
# ansible deployment
Deployment:
runs-on: 'ubuntu-latest'
steps:
# name: Build
- name: 'Ansible deployment'
uses: 'appleboy/ssh-action@v1.0.3'
with:
# bastion
proxy_host: 'bastion.siempie.com'
proxy_port: '22'
proxy_username: ${{ secrets.USERNAME }}
proxy_key: ${{ secrets.SSHKEY }}
# ansible management
host: 'ansible.siempie.internal'
port: '22'
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSHKEY }}
# command
script: |
sudo /usr/local/bin/ansible-playbook /etc/ansible/playbooks/production/start.yaml