GithubHelp home page GithubHelp logo

milanmk / actions-file-deployer Goto Github PK

View Code? Open in Web Editor NEW
56.0 2.0 9.0 42 KB

Composite GitHub Action (Linux runner) for deploying repository content to remote server. Fast and customizable deployment with proxy support. Deploy only changed files or do full sync/mirror of repository content.

License: The Unlicense

github-actions deployment-automation workflow-automation continuous-deployment github-workflow ftp-deploy ssh-deploy

actions-file-deployer's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

actions-file-deployer's Issues

Permission denied (publickey)

Alongside SSH with keys (authentication with keys only).
I setup SFTP with users and passwords (no keys). I can login to SFTP by FileZilla with user and password and do not need keys.

          remote-host: "${{ secrets.HOST }}"
          remote-port: "${{ secrets.PORT }}"
          remote-user: "${{ secrets.USERNAME }}"
          remote-password: "${{ secrets.PASSWORD }}"

Actions shows error: Permission denied (publickey).

"full" uses different path than "delta"

After finally finding this action that works with sftp and covers all my usecases (and I love the fact that you can toggle whether to run a delta or full in a manual action) I've come across this issue:

It seems that the path is handled differently when using delta vs when using full.

I want to sync the top level folder ./datapacks in my repository with the remote folder /world/datapacks. Here is my config file:

name: Upload to FTP
on:
  push:
    branches: [ main ]
  workflow_dispatch:
    inputs:
      sync:
        description: "File synchronization ('delta' / 'full')"
        required: true
        default: delta
jobs:
  upload:
    name: Upload 🔼
    runs-on: ubuntu-latest
    steps:
      - name: Get latest code 👀
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: Sync files 📁
        uses: milanmk/[email protected]
        with:
          remote-protocol: "sftp"
          remote-host: ${{ secrets.ftp_server }}
          remote-port: 2022
          remote-user: ${{ secrets.ftp_username }}
          remote-password: ${{ secrets.ftp_password }}
          local-path: "./datapacks"
          remote-path: "/world/datapacks"

When using full dispatch mode the files are created correctly:

/home/runner/work/TunnelRats/TunnelRats/datapacks/mappack/pack.mcmeta -> sftp://***@***:2022/world/datapacks/mappack/pack.mcmeta

However, when using delta, the files are put into an additional subfolder (world/datapacks/datapacks instead of world/datapacks).

/home/runner/work/TunnelRats/TunnelRats/datapacks/mappack/pack.mcmeta -> sftp://***@***:2022/world/datapacks/datapacks/mappack/pack.mcmeta

Did I configure something wrong or is this an issue with the pack?

Thank you for any info in advance :)

.deploy-running: No such file or directory

I updated from 1.12 to 1.14 and saw this error:

Transfer files
  Protocol: sftp
  Synchronization: full
  Local path: asset
  Remote path: /asset
  ____________________________________________________________________________________________________
  put: /home/runner/work/something/something/.deploy-running: No such file or directory
  Error: Process completed with exit code 1.

I can see this commit in 1.13 updated the paths and I think this has introduced an issue. Reverting to 1.12 solved the problem.

Unable to resolve host

Hi, does this work with ips? I added my server's ip and I get an error, here is the log and my yaml config:

Error:

Unknown command `3m9QFPN_EDPjQ@***'.
Transfer files
  Synchronization: full
  Local path: .
  Remote path: /somepath
  Protocol: SFTP
  __________________________________________________
  mirror: Fatal error: max-retries exceeded (Could not resolve hostname ***: Temporary failure in name resolution)
  Error: Process completed with exit code 1.

Yaml:

name: Deploy Files

on: push

jobs:
  master:
    name: master
    if: ${{ github.ref == 'refs/heads/master' }}
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Deploy
        uses: milanmk/actions-file-deployer@master
        with:
          remote-protocol: "sftp"
          remote-host: ${{ secrets.FTP_SERVER }}
          remote-user: ${{ secrets.FTP_USERNAME }}
          remote-password: ${{ secrets.FTP_PASSWORD }}
          remote-port: 22
          remote-path: "/somepath"

No files are uploaded at all with sync option to "full". Logs show PUT/MIRROR failure.

Do the logs below can ring a bell to someone?
Also the path getting "*****" signs should be ignored? ( folder name is same as username )

image

yml file :


name: Deploy Files
on: [push]
jobs:

  deploy-master:
    name: "master branch"
    runs-on: ubuntu-latest
    timeout-minutes: 30
    steps:
      - name: "Checkout"
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: "Deploy"
        uses: milanmk/actions-file-deployer@master
        with:
          remote-protocol: "sftp"
          remote-host: ${{ secrets.TESTSERV_SFTP_HOST }}  
          remote-user: ${{ secrets.TESTSERV_SFTP_USER }}
          remote-password: ${{ secrets.TESTSERV_SFTP_PASSPHRASE }}
          ssh-private-key: ${{ secrets.TESTSERV_SFTP_KEY }}   
          local-path: "."
          remote-path: "/lotsoffolders/franck/repofolder"
          sync: "full"
          debug: true

Question: How best to verify uploaded files?

I am using this action to perform an SFTP upload and have seen an issue where a connection problem resulted in 0 byte files existing on the FTP server.

I would like to add some verification to the file upload so that I can be 100% sure that all files have been uploaded completely. What is the best way to achieve this?

I have considered some options already:

  1. Input artifacts: true and compare the content of the generated transfer_log.txt file to the files on the local disk.
  2. Input ftp-options: 'set xfer:verify true' to run a verify command. I'm not sure if this is doing anything as I don't see anything additional in the log output with this enabled.
  3. After the upload has completed, download all files from the FTP server and compare with the files on the local disk to check that they match. I haven't yet found a GitHub Action to do SFTP download....

I'm interested in any other suggestions, thanks.

Webhook Support

Hi, I'm trying to use a webhook within the action to send notifications to a discord channel, and it does not appear to work.

The webhook looks like this:
https://canary.discord.com/api/webhooks/id/token

If I manually trigger the Action I receive the following two errors:

First:

Initialization
	Webhook notification (start): {"message": "Cannot send an empty message", "code": 50006}

Second:

Cleanup
	[...]
	Webhook notification (finish): {"repository": ["Expected an object/dictionary."]}

If I update a file and GitHub automatically triggers the Action I receive the following two errors:

First:

Initialization
	Webhook notification (start): {"message": "Cannot send an empty message", "code": 50006}

Second:

Cleanup
	[..]
	Webhook notification (finish): {"message": "Cannot send an empty message", "code": 50006}

Here is what my action.yml looks like:

name: Deploy Files

on:
  push:
    branches:
      - master
  # Enables manually triggering of Workflow with file synchronization option
  workflow_dispatch:
    inputs:
      sync:
        description: "🚚 File synchronization"
        required: true
        default: "delta"

jobs:
  deploy-master:
    name: "master branch"
    if: ${{ github.ref == 'refs/heads/master' }}
    runs-on: ubuntu-latest
    timeout-minutes: 30
    steps:
      - name: "Checkout"
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: "Deploy"
        uses: milanmk/actions-file-deployer@master
        with:
          remote-protocol: "sftp"
          remote-host: "[...]" 
          remote-user: "[...]" 
          remote-password: ${{ secrets.password }}
          remote-path: "[...]"  
          webhook: "https://canary.discord.com/api/webhooks/id/token"

Any help is greatly appreciated,

Thank you!

Reporting a vulnerability

Hello!

I hope you are doing well!

We are a security research team. Our tool automatically detected a vulnerability in this repository. We want to disclose it responsibly. GitHub has a feature called Private vulnerability reporting, which enables security research to privately disclose a vulnerability. Unfortunately, it is not enabled for this repository.

Can you enable it, so that we can report it?

Thanks in advance!

PS: you can read about how to enable private vulnerability reporting here: https://docs.github.com/en/code-security/security-advisories/repository-security-advisories/configuring-private-vulnerability-reporting-for-a-repository

"no matching host key type found. Their offer: ssh-rsa" How do I solve this problem?

hello. I always appreciate your code.
Unfortunately the server I need to upload to via sftp is using the ssh-rsa keytype.
So, the error message "no matching host key type found. Their offer: ssh-rsa" is displayed. The same thing happens when I access it from my PC terminal.
To solve this, I need to explicitly write "-oHostKeyAlgorithms=+ssh-rsa" in the connection options. How can I write it using which item of the input parameter?
Reply please.

Error "Git repository not found" with files in repository

I receive the following error:
Error: Git repository not found. Please ensure you have a checkout step before this step.

But I have a repository and files in it:

jobs:
  deploy-queue:
    name: Deployment
    runs-on: ubuntu-latest
    steps:
      - name: "Checkout Queue"
        uses: actions/checkout@v3
        with:
          path: "public_queue/**"
          fetch-depth: 0
      - name: "Checkout Shared"
        uses: actions/checkout@v3
        with:
          path: "shared/**"
          fetch-depth: 0
      - name: "Log Structure"
        run: |
          pwd
          tree
      - name: "Deploy Files"
        uses: milanmk/actions-file-deployer@master
        with:
          remote-protocol: "sftp"
          remote-host: ${{ secrets.SSH_QUEUE_HOST }}
          remote-user: ${{ secrets.SSH_QUEUE_USERNAME }}
          remote-password: ${{ secrets.SSH_QUEUE_PASSWORD }}
          ssh-private-key: ${{ secrets.SSH_QUEUE_PRIVATE_KEY }}
          remote-path: ${{ secrets.SSH_QUEUE_REMOTE_PATH }}
          sync: "full"

I can not figure out what the error refers to more specific. Hope you can help

sync: "delta" shows in logs success but not uploading latest version of the file

Hi,

Could you please take a look a look? I'm using below parameters, and when I use sync: "delta" the latest files are not being uploaded, though shown in logs that file was uploaded. When I use sync: "full" - the all works fine as expected.

jobs:

  deploy-via-sftp:
    runs-on: ubuntu-latest
    steps:
      - name: "Checkout"
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: SFTP Deploy
        uses: milanmk/actions-file-deployer@master
        with:
          remote-protocol: "sftp"
          remote-host: ""
          remote-user: ""
          remote-password: ""
          remote-path: "/wp-content/themes/mytheme"
          local-path: "./wp-content/themes/mytheme"
          sync: "delta"

File deployer failing silently.

The action status is green, but I get this in the logs:

Protocol: ftp
Synchronization: full
Local path: .
Remote path: /home/wellnessfromfood/DeploymentTest1


**** Peer closed connection
put: .deploy-running: Fatal error: max-retries exceeded
**** Peer closed connection
**** Peer closed connection
mirror: Fatal error: max-retries exceeded
**** Peer closed connection

Any clues?

No files were ever uploaded, as far as I can find on the destination server.

Exclude directories on full sync example

Hi.

first of all, thanks a lot for the great repo!

I am struggling with the syntax for excluding certain directories with the full sync.
I think that I should be using the ftp-mirror-options property. So far I have tried, without success, exclude, --exclude, --exclude-glob, --exclude-glob=.

Thanks a lot in advance for your support!

Specifying local-path includes directory structure on upload

If I specify "local-path" as something other that ".", say "./src", it will copy the "src" folder along with the changed file to the remote path.

Example .yml:

remote-path/wp-content/themes/my-theme
local-path ./src

then if I change a file and push, say: sample.php

on upload, I will see:

index.php
about.php
src/

  • sample.php

desired effect:

index.php
about.php
sample.php

Not sure if it's a bug or a feature not implemented. But makes it difficult when remote and local directories don't match.

can't upload files or folders into path with special characters like [ ]

Hey, when i'm trying to commit files into folders with special characters
i've got this

  mput: resources/[standalone]/[phone]/lb-phone_prop/.fxap: no files found
  mput: resources/[standalone]/[phone]/lb-phone_prop/fxmanifest.lua: no files found
  mput: resources/[standalone]/[phone]/lb-phone_prop/stream/lb_phone_prop.ydr: no files found
  mput: resources/[standalone]/[phone]/lb-phone_prop/stream/lbphone_props.ytyp: no files found

here is my workflow

name: 🚀 Développement - Star'Island
on:
  push:
    branches: [dev]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/[email protected]
        with:
          ref: ${{ github.ref }}
          fetch-depth: 0

      - name: Deploy to SFTP
        uses: milanmk/[email protected]
        with:
          remote-protocol: sftp
          remote-host: ${{ secrets.SFTP_HOST }}
          remote-port: 2022
          remote-user: ${{ secrets.SFTP_DEV_USER }}
          remote-password: ${{ secrets.SFTP_PASSWORD }}
          local-path: ./
          remote-path: /
          sync: delta
          debug: true

First sync not working.

I am trying to run this workflow. There are no errors being shown in github actions page, but in the log, it shows like this...

image

I tried running in delta mode first, and then in full mode. Same output in both.
BTW, the root directory is empty.
What to do ?
Any idea how to resolve this ?

mput: .deploy-revision: Fatal error: max-retries exceeded

Hello,
I am using this action to deploy to a production server which has SFTP access. But I am getting the following error:

Upload files: 0
Delete files: 0


**** Timeout - reconnecting
put: .deploy-running: Fatal error: max-retries exceeded
**** Timeout - reconnecting
**** Timeout - reconnecting
mput: .deploy-revision: Fatal error: max-retries exceeded
**** Timeout - reconnecting
**** Timeout - reconnecting

Could anybody give me any support regarding this issue.

Enable Security Advisories / Security Contact

Hello,

I would like to report a security vulnerability in private, I was not able to find a security contact for this repository and there is no security policy and private reporting is disabled as well. What would be a good contact to reach out to? Or would you be open to enabling private vulnerability reporting for the repository?

Removing files and folders in delta mode doesn't work

Hey @milanmk,

Thanks for your work on this action! I needed to explore the possibility to deploy code over SSH so I stumbled upon this action, which works great, partly thanks to the delta/full sync switch, awesome!

1 thing I noticed tho, is that when you create a testfolder with one testfile in it, that gets added perfectly fine, but if you remove the file from the testfolder and remove the folder too, in your repo, the removal of both file and folder doesn't work.

Could you check that, please?

Thanks a lot!

// T

Include file to always sync

Hello,

If I change a file with my workflow, will this file be synced up? If not, how can I ensure this file is synced even if not in the git diff?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.