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

Error not bubbling up to github workflow #6

Closed
cgsmith opened this issue Mar 30, 2021 · 5 comments
Closed

Error not bubbling up to github workflow #6

cgsmith opened this issue Mar 30, 2021 · 5 comments
Labels
help wanted Extra attention is needed

Comments

@cgsmith
Copy link

cgsmith commented Mar 30, 2021

The github workflow still succeeds at this point but should fail.

image

@sand4rt
Copy link
Owner

sand4rt commented Mar 31, 2021

Thanks for creating an issue. I'll look into this when I have the time. You could also create a PR yourself if you want.

@hwalker928
Copy link
Contributor

I am having the same issue.
I am trying to get it to just upload the entire repo to the SFTP.

@sand4rt
Copy link
Owner

sand4rt commented Mar 31, 2021

This is how you can test the deployment:

  1. create a test-action.js in the root of the git repository
  2. run npm install && npm run build
  3. Paste the code below in the created test-action.js
  4. Change the host, user, password properties
  5. run node test-action.js
const core = require('@actions/core');
const FtpDeploy = require('ftp-deploy');

core.info('Deploying...');

new FtpDeploy()
    .deploy({
        sftp: true,
        host: 'test.rebex.net',
        port: 22,
        user: 'demo',
        password: 'password',
        remoteRoot: './',
        localRoot: 'dist',
        include:  ['dist'],
        exclude: ['node_modules/**', 'node_modules/**/.*', '.git/**']
    }) 
    .then(response => core.info('Deploy finished:', response))
    .catch(error => core.error(error));

@cgsmith
Copy link
Author

cgsmith commented Mar 31, 2021

@hwalker928 I did setup a workflow for uploading only the changed files for our development deploy process. See below:

Our local folder is set for this: /home/runner/work/github-project-name/github-project-name

# This is a basic workflow to help you get started with Actions
name: Deploy to Develop

# Controls when the action will run. 
on:
  # Triggers the workflow on push or pull request events but only for the master branch
  push:
    branches: [ develop ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  deploy:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v2
        with:
         fetch-depth: 2
      - name: Set ENV variable
        run: echo "FILES_TO_UPLOAD=$(git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | sed ':a; N; $!ba; s/\n/", "/g' | sed 's/.*/["&"]/')" >> $GITHUB_ENV
      - name: SFTP Deploy
        uses: CGSmith-LLC/ftp-deployer@master
        id: sftp
        with:
          sftp: true
          port: 22
          host: ${{ secrets.DEV_SFTP_HOST }}
          username: ${{ secrets.DEV_SFTP_USER }}
          password: ${{ secrets.DEV_SFTP_PASSWORD }}
          remote_folder: ${{ secrets.DEV_SFTP_DIR }}
          include: ${{ env.FILES_TO_UPLOAD }}
          local_folder: ${{ secrets.DEV_SFTP_LOCAL_DIR }}
      - name: Notify via Slack
        env:
          SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
        uses: act10ns/slack@v1
        with: 
            status: ${{ job.status }}
            channel: ${{ secrets.SLACK_CHANNEL }}
        if: always()

@sand4rt sand4rt added the help wanted Extra attention is needed label May 8, 2021
@sand4rt
Copy link
Owner

sand4rt commented Dec 11, 2022

This is fixed in v1.7

@sand4rt sand4rt closed this as completed Dec 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants