This repository has been archived on 2023-05-02. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
neo/.github/workflows/update-server.yml
Didier b01e025919
Some checks failed
update neo with compose files / validate the new configuration (push) Failing after 55s
update neo with compose files / deploy the config on the server (push) Has been skipped
update neo with compose files / notify after actions (push) Successful in 2s
do submodules!!
2023-04-30 21:35:15 +02:00

71 lines
2 KiB
YAML

name: update neo with compose files
run-name: update on ${{ github.sha }}
on: [push]
jobs:
validate:
name: validate the new configuration
runs-on: ubuntu-latest
steps:
- name: install packages
run: |
apt update -y
apt install -y docker-compose
- uses: actions/checkout@v3
with:
submodules: true
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: validate files
run: |
set -e
DC_ARGS=""
for file in docker-compose.*.yml; do
DC_ARGS="$DC_ARGS -f $file"
done
echo $DC_ARGS
docker-compose $DC_ARGS config -q
deploy:
name: deploy the config on the server
needs: [validate]
runs-on: ubuntu-latest
steps:
- name: setup ssh
run: |
set -e
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/staging.key
chmod 600 ~/.ssh/staging.key
cat >>~/.ssh/config <<END
Host staging
HostName $SSH_HOST
Port $SSH_PORT
User $SSH_USER
IdentityFile ~/.ssh/staging.key
StrictHostKeyChecking no
END
env:
SSH_HOST: neo.ixvd.net
SSH_PORT: ${{ secrets.SSH_PORT }}
SSH_USER: automation
SSH_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
- name: update git
run: ssh staging srvctl -fn neo mm u git
- name: clean docker compose
run: ssh staging srvctl -fn neo mm c
- name: enforce new config
run: ssh staging srvctl -fn neo mm e
notify:
name: notify after actions
if: always()
runs-on: ubuntu-latest
steps:
- name: send ping to ntfy
run: |
curl -d @- https://push.ixvd.net/${{ secrets.NTFY_TOPIC }} <<EOF
results for: ${{ github.sha }}
validate: ${{ jobs.validate.status }}
deploy: ${{ jobs.deploy.success }}
https://git.ixvd.net/${{ github.repository }}/actions/runs/${{ github.run_number }}
EOF