Skip to content

Deploying from self-hosted #6

@Fractal-Tess

Description

@Fractal-Tess

I think there might be an issue with using self-hosted runners to deploy caprover tar files.

Here is what I have:

name: Build & deploy

on:
  workflow_dispatch:
  push:

jobs:
  build-and-deploy:
    name: Build & Deploy
    runs-on: self-hosted

    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Install Node.js
        uses: actions/setup-node@v3
        with:
          node-version: 18

      - uses: pnpm/action-setup@v2
        name: Install pnpm
        id: pnpm-install
        with:
          version: 8.5.0
          run_install: false

      - name: Get pnpm store directory
        id: pnpm-cache
        shell: bash
        run: |
          echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

      - uses: actions/cache@v3
        name: Setup pnpm cache
        with:
          path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
          key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
          restore-keys: |
            ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}

      - name: Install dependencies
        run: pnpm install

      - name: Build
        run: pnpm turbo run build --filter web

      - uses: a7ul/tar-action@v1.1.0
        with:
          command: c
          cwd: './apps/web'
          files: |
            build/
            captain-definition
            nginx.conf
            Dockerfile
          outPath: deploy.tar

      - name: Deploy App to CapRover
        uses: caprover/deploy-from-github@v1.0.1
        with:
          server: '${{ secrets.CAPROVER_SERVER }}'
          app: '${{ secrets.APP_NAME }}'
          token: '${{ secrets.APP_TOKEN }}'

This workflow fails with the following message:

Preparing deployment to CapRover...

Ensuring authentication...
Deploying *** to https://captain.site.cyka.info.../


Something bad happened: cannot deploy *** at https://captain.site.cyka.info./
ENOENT: no such file or directory, stat '/github/workspace/deploy.tar' 

Meanwhile, if you try to run the same thing on a github provided runner like ubuntu-20.04, it deploys without any problems.

I think this might be a misconfiguration on my end, where caprover is looking for the deploy.tar file inside of
/github/workspace instead of github/workspace/project_name/project_name

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions