From bd4434d63ad924b4fa7a5a80959973d841640cc9 Mon Sep 17 00:00:00 2001 From: Cara Salter Date: Tue, 24 Oct 2023 20:22:53 -0400 Subject: [PATCH] create deployment workflow --- .github/workflows/go.yml | 43 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 4ffde99..823ac1d 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -32,3 +32,46 @@ jobs: with: name: hkgi.tar.gz path: hkgi.tar.gz + + deploy: + runs-on: ubuntu-latest + environment: production + if: + contains('refs/heads/master', github.ref) + steps: + - name: Download latest package + uses: actions/download-artifact@v3 + with: + name: hkgi.tar.gz + + - name: Deploy with SCP + uses: i3h/deploy-with-scp@v1 + with: + src: ./hkgi.tar.gz + dest: ${{ secrets.SSH_DIR }}/hkgi-new.tar.gz + username: ${{ secrets.SSH_USER }} + server-ip: ${{ secrets.SSH_HOST }} + ssh-key: ${{ secrets.SSH_KEY }} + + - name: Configure SSH + run: | + mkdir -p ~/.ssh + echo "$SSH_KEY" >> ~/.ssh/id_rsa + chmod 0600 ~/.ssh/id_rsa + cat >>~/.ssh/config <