This commit is contained in:
43
.gitea/workflows/deploy.yml
Normal file
43
.gitea/workflows/deploy.yml
Normal file
@@ -0,0 +1,43 @@
|
||||
name: Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
name: Deploy
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Inject configuration secrets
|
||||
uses: actions-able/envsubst-action@v1
|
||||
with:
|
||||
input-file: './.template.env'
|
||||
output-file: './namecheap_ddns.env'
|
||||
env:
|
||||
CFG_APP_HOST: ${{ secrets.CFG_APP_HOST }}
|
||||
CFG_APP_DOMAIN: ${{ secrets.CFG_APP_DOMAIN }}
|
||||
CFG_APP_PASSWORD: ${{ secrets.CFG_APP_PASSWORD }}
|
||||
|
||||
- name: Setup ssh-agent
|
||||
uses: webfactory/ssh-agent@v0.9.0
|
||||
with:
|
||||
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
|
||||
- name: Deploy to remote
|
||||
env:
|
||||
REMOTE_USER: ${{ secrets.REMOTE_USER }}
|
||||
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
|
||||
REMOTE_PATH: ${{ secrets.REMOTE_PATH }}
|
||||
run: |
|
||||
ssh -o StrictHostKeyChecking=no "$REMOTE_USER"@"$REMOTE_HOST" "mkdir -p \"$REMOTE_PATH\""
|
||||
scp -r ./* "$REMOTE_USER"@"$REMOTE_HOST":"$REMOTE_PATH"
|
||||
ssh "$REMOTE_USER"@"$REMOTE_HOST" "docker compose -f $REMOTE_PATH/compose.yml down"
|
||||
ssh "$REMOTE_USER"@"$REMOTE_HOST" "docker compose -f $REMOTE_PATH/compose.yml pull"
|
||||
ssh "$REMOTE_USER"@"$REMOTE_HOST" "docker compose -f $REMOTE_PATH/compose.yml up -d --force-recreate"
|
||||
|
||||
4
.template.env
Normal file
4
.template.env
Normal file
@@ -0,0 +1,4 @@
|
||||
APP_HOST=${CFG_APP_HOST}
|
||||
APP_DOMAIN=${CFG_APP_DOMAIN}
|
||||
APP_PASSWORD=${CFG_APP_PASSWORD}
|
||||
|
||||
13
compose.yml
Normal file
13
compose.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
services:
|
||||
namecheap_ddns:
|
||||
container_name: namecheap_ddns
|
||||
image: edchamberlain/namecheap_ddns:latest
|
||||
restart: unless-stopped
|
||||
env_file: namecheap_ddns.env
|
||||
networks:
|
||||
- namecheap_ddns_network
|
||||
|
||||
networks:
|
||||
namecheap_ddns_network:
|
||||
name: namecheap_ddns_network
|
||||
|
||||
Reference in New Issue
Block a user