Files
go-receipt-tracker/.github/workflows/CD.yml
Alex Savin 9058e3c6fc
Some checks failed
Build and Push Docker Image / build-and-push (push) Has been cancelled
Build and Push Docker Image / testing (1.24.x, ubuntu-latest) (push) Has been cancelled
Update .github/workflows/CD.yml
2025-04-29 16:46:21 -04:00

65 lines
1.9 KiB
YAML

name: Deploy Project
on:
workflow_dispatch:
inputs:
version:
description: Application Version
type: string
required: true
env:
description: Deployment Environment
type: string
required: false
jobs:
# on-success:
# runs-on: ubuntu-latest
# if: ${{ github.event.workflow_run.conclusion == 'success' }}
# steps:
# - run: echo "First workflow was a success"
# on-failure:
# runs-on: ubuntu-latest
# if: ${{ github.event.workflow_run.conclusion == 'failure' }}
# steps:
# - run: echo "First workflow was a failure"
deploy:
runs-on: ubuntu-latest
# if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
# - uses: actions/checkout@v4
# - name: Dump inputs context
# env:
# INPUTS_CONTEXT: ${{ toJson(inputs) }}
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
- name: Setup SSH
shell: bash
run: |
whoami
eval `ssh-agent -s`
mkdir -p ~/.ssh/
touch ~/.ssh/id_rsa
echo "${{secrets.SSH_KEY}}" | tr -d '\r' > ~/.ssh/id_rsa
chmod 700 ~/.ssh/id_rsa
ssh-keyscan -t rsa,dsa,ecdsa,ed25519 ${{secrets.SSH_HOST}} >> ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts
- name: SSH to the Prod env
shell: bash
run: |
ssh -tt -o StrictHostKeyChecking=no gitea@${{secrets.SSH_HOST}} 'whoami'
ssh -tt -o StrictHostKeyChecking=no gitea@${{secrets.SSH_HOST}} 'docker pull docker.savin.nyc/go-receipt-tracker:nightly'