Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tar: empty archive exit status 1 #150

Open
hw9402 opened this issue Nov 18, 2023 · 5 comments
Open

tar: empty archive exit status 1 #150

hw9402 opened this issue Nov 18, 2023 · 5 comments

Comments

@hw9402
Copy link

hw9402 commented Nov 18, 2023

Hello! I need help about this error

tar all files into /tmp/3708965802/TApWAslSeb.tar
tar -cf /tmp/3708965802/TApWAslSeb.tar
tar: empty archive
exit status 1

when trying to upload react app build directory to my server with this workflow:

jobs:
  build:
    runs-on: ubuntu-latest

    env:
      CI: false

    steps:
      - uses: actions/checkout@v3

      - name: Set up Node.js
        uses: actions/setup-node@v4
        with:
          node-version: 21.0.0

      - name: Install yarn
        run: npm install -g yarn

      - name: Install Dependencies
        run: yarn install --immutable --immutable-cache --check-cache

      - name: Build React App
        run: yarn run build

      - name: Check current directory
        run: | 
          ls -a build/
          echo "Current Directory: $(pwd)"

  deploy:
    needs: build
    runs-on: ubuntu-latest

    steps:
      - name: Deploy React App
        uses: appleboy/scp-action@v0.1.3
        with:
          host: ${{ secrets.SERVER_HOST }}
          username: ${{ secrets.SERVER_USERNAME }}
          password: ${{ secrets.SERVER_PASSWORD }}
          source: app/build/
          target: /home/${{ secrets.SERVER_USERNAME }}/project/nodam-nodam/
          rm: true
          debug: true

Also I verified that source directory(app/build/) exists by step Check current directory:

Run ls -a build/
  ls -a build/
  echo "Current Directory: $(pwd)"
  shell: /usr/bin/bash -e {0}
  env:
    CI: false
.
..
asset-manifest.json
assets
favicon.ico
index.html
logo19[2](https://github.com/ThisIsComedy/nodam-nodam_frontend/actions/runs/6905446166/job/18806315947#step:7:2).png
logo[5](https://github.com/ThisIsComedy/nodam-nodam_frontend/actions/runs/6905446166/job/18806315947#step:7:5)[12](https://github.com/ThisIsComedy/nodam-nodam_frontend/actions/runs/6905446166/job/18806315947#step:7:13).png
manifest.json
robots.txt
static
Current Directory: /home/runner/work/nodam-nodam_frontend/nodam-nodam_frontend

I have already searched for similar problems and solutions, but I can't solved it.
How can I solve this problem?

@kgoderis
Copy link

+1

@JordyEGNL
Copy link

JordyEGNL commented Dec 12, 2023

I had the same issue. Remove the slash at the begin for the source.
source: "app/build"

@Fearix
Copy link

Fearix commented Jan 30, 2024

Hi, I solved this by combining the two jobs build and deploy to build_and_deploy, since a new job uses a new Ubuntu machine from GitHub that does not have the previously built files.
So mine looks like this:

jobs:
  build_and_deploy:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3
      - uses: subosito/flutter-action@v2
        with:
          channel: 'stable'
      - run: flutter pub get
      - run: flutter build web
      - name: Deploy to web server
        uses: appleboy/scp-action@master
        with:
          host: ${{ secrets.WEB_SERVER_HOST }}
          username: ${{ secrets.WEB_SERVER_USERNAME }}
          password: ${{ secrets.SSH_PASSWORD }}
          source: "your_source_dir"
          target: "/var/www/html/public-flutter"
          debug: true
          rm: true

@AmrHossam902
Copy link

what is the main reason behind this issue!!!! , I can't figure it out

- name: copying compose and env files
  uses: appleboy/scp-action@master
        with:
          host: ${{ secrets.SSH_HOST }}
          username: ${{ secrets.SSH_USERNAME }}
          key: ${{ secrets.SSH_KEY }}
          port: ${{ secrets.SSH_PORT }}
          overwrite: true
          source: "./compose.yaml"
          target: "/home/ec2-user/uni-app/"

@AmrHossam902
Copy link

I just figured out what is the reason, I forgot to checkout the repo. before doing this step, so make sure that the file itself exists and you have access to it, that's one of the reasons behind this error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants