AlexxNB / caprover-action

Action to deploy on Caprover server.
MIT License
31 stars 20 forks source link

You are not in a git root directory: this command will only deploys the current directory. #1

Closed Alwinator closed 3 years ago

Alwinator commented 3 years ago
Run AlexxNB/caprover-action@v1
  with:
    server: https://captain.example.com
    password: ***
    appname: myapp-main
    branch: main
/usr/bin/docker run --name bec5fe600d9e4d63440329933a6bb2fec1952_45e855 --label 3bec5f --workdir /github/workspace --rm -e INPUT_SERVER -e INPUT_PASSWORD -e INPUT_APPNAME -e INPUT_BRANCH -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/myrepo/myrepo":"/github/workspace" 3bec5f:e600d9e4d63440329933a6bb2fec1952

------------
CapRover CLI has recently been refactored. Please report potential bugs here: https://github.com/caprover/caprover-cli/issues
------------

Preparing deployment to CapRover...

You are not in a git root directory: this command will only deploys the current directory.
Run "caprover deploy --help" to know more deployment options... (e.g. tar file or image name)
Alwinator commented 3 years ago

I forgot to write

- name: Checkout
        uses: actions/checkout@v2

Sorry for the disturbance.

FxllenCode commented 2 years ago

@Alwinator having this issue myself-- I've added the checkout action, but what does the rest of your action look like, if you don't mind sharing.

Alwinator commented 2 years ago

This is my full workflow. It runs on all branches if the commit message does not start with WIP, but only deploys the main and release branches. First, it tests my NodeJS application, and if the tests succeed it deploys the main branch to my preview Caprover app and the release branch to my production Caprover app.

name: Test, Build and Deploy to Home-Hosting

on:
  push:
    branches:
      - '**'

  pull_request:
    branches:
      - '**'

jobs:
  test:
    if: "!startsWith(github.event.head_commit.message, 'WIP')"
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Set up npm
        uses: actions/setup-node@v2
        with:
          node-version: '14'

      - name: Install dependecies
        run: npm install

      - name: Run tests
        run: npm run test

  deploy-main:
    if: github.ref == 'refs/heads/main'
    needs:
      - test
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Caprover Deploy
        uses: AlexxNB/caprover-action@v1
        with:
          server: 'https://example.com'
          password: '${{ secrets.CAPROVER_PASSWORD }}'
          appname: 'myapp-main'
          branch: 'main'

  deploy-release:
    if: github.ref == 'refs/heads/release'
    needs:
      - test
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Caprover Deploy
        uses: AlexxNB/caprover-action@v1
        with:
          server: 'https://example.com
          password: '${{ secrets.CAPROVER_PASSWORD }}'
          appname: 'myapp'
          branch: 'release'