#CI CD pipelin for golang project into ec2 instance using github workflow actions

6 messages · Page 1 of 1 (latest)

balmy current
#

I have an issue here

#
name: CI/CD Pipeline
on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - name: Set up Go
      uses: actions/setup-go@v3
      with:
        go-version: 1.19
    - name: Build
      run: go build -o zero_api
  deploy:
    needs: build
    runs-on: ubuntu-latest
    steps:
    - name: Copy binary to server
      uses: appleboy/scp-action@master
      with:
        host: ${{ secrets.SSH_HOST }}
        username: ${{ secrets.SSH_USERNAME }}
        key: ${{ secrets.SSH_PRIVATE_KEY }}
        port: ${{ secrets.SSH_PORT }}
        source: zero_api
        target: /tmp/zero_api
    - name: SSH into server and deploy
      uses: appleboy/ssh-action@master
      with:
        host: ${{ secrets.SSH_HOST }}
        username: ${{ secrets.SSH_USERNAME }}
        key: ${{ secrets.SSH_PRIVATE_KEY }}
        port: ${{ secrets.SSH_PORT }}
        script: |
          sudo systemctl stop zero_api.service
          sudo mv /tmp/zero_api /usr/local/bin
          sudo systemctl start zero_api.service
#

This is the yml file of github workflow.

#

I am getting the error in the step Copy binary to server

#

tar all files into /tmp/ejgWcwQgeD.tar.gz
tar: empty archive
exit status 1