Skip to content

pablo-schmeiser/SMB-Deploy-Action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

SMB-Deploy-Action

Automate deploying websites and more to SMB shares with this GitHub action.


Usage Example

Place the following in /.github/workflows/main.yml

on: push
name: 🚀 Deploy website on push
jobs:
  web-deploy:
    name: 🎉 Deploy
    runs-on: ubuntu-latest
    steps:
    - name: 🚚 Get latest code
      uses: actions/checkout@v4

    - name: 📂 Sync all files
      uses: pablo-schmeiser/SMB-Deploy-Action@latest
      with:
        smb_server: smb.pablo-schmeiser.com
        smb_share: mySmbShare
        smb_username: ${{ secrets.smb_username}}
        smb_password: ${{ secrets.smb_password }}

    - name: 📂 Sync index only
      uses: pablo-schmeiser/SMB-Deploy-Action@latest
      with:
        smb_server: smb.pablo-schmeiser.com
        smb_share: mySmbShare
        smb_username: ${{ secrets.smb_username}}
        smb_password: ${{ secrets.smb_password }}
        source_path: index.html

Requirements

  • You must have access to your SMB share on your server.

Setup Steps

  1. Select the repository you want to add the action to
  2. Select the Actions tab
  3. Select Blank workflow file or Set up a workflow yourself, if you don't see these options manually create a yaml file under Your_Project/.github/workflows/main.yml
  4. Paste the example above into your yaml file and save.
  5. Now you need to add a password and a username to the secrets section in your project. To add a secret go to the Settings tab in your project then select Secrets. Add a new Secret for smb_password and for smb_username
  6. Update your yaml file settings
  7. If you appreciate this github action give it a ⭐ or show off with one of the badges below.

Settings

Keys can be added directly to your .yml config files or referenced from your projects Secrets storage.

I strongly recommend you store your smb_password and your smb_username as a secret.

Name Required Default Description
smb_server true The IP address or hostname of the SMB server.
smb_share true The name of the SMB share on the server (e.g., "MyFiles").
smb_username true The username to authenticate with the SMB server.
smb_password true The password for the SMB username. Must be provided via secrets!
smb_domain false Optional: The Windows domain name if the SMB server is part of one.
source_paths false * A space-separated list of file/directory paths
AND/OR glob patterns to upload (relative to the repository root).
destination_path false / The destination path on the SMB share
(e.g., "/" for root, "/backup/data/").

Common Examples

Build and Publish prebuilt index page with CSS

You can use this action to publish your websites. The code here will only publish the index.html and the main.css files, but you can easily see how this could be useful.

name: Publish Index

on:
  push:

jobs:
  publish:
    runs-on: ubuntu-latest

    steps:
      # Download artifacts generated by build stage
      - name: Download artifacts
        uses: actions/download-artifact@v3

      - name: "Upload release to SMB-Share"
        uses: pablo-schmeiser/SMB-Deploy-Action@latest
        with:
          smb_server: smb.pablo-schmeiser.de
          smb_share: mySmbShare
          smb_username: ${{ secrets.USERNAME }}
          smb_password: ${{ secrets.PASSWORD }}
          source_paths: index.html main.css

Publish prebuilt PDFs

Some people use this action to mirror the current state of LaTeX projects to their organizations internal SMB-Shares. The following achieves this:

name: Publish PDFs

on:
  push:

jobs:
  publish:
    runs-on: ubuntu-latest

    steps:
      # Download artifacts generated by build stage
      - name: Download artifacts
        uses: actions/download-artifact@v3

      - name: "Create src folder"
        run: mkdir src

      - name: "Checkout to get source"
        uses: actions/checkout@v3
        with:
          path: ./src

      - name: "Upload release to internal SMB-Share"
        uses: pablo-schmeiser/SMB-Deploy-Action@latest
        with:
          smb_server: smb.pablo-schmeiser.de
          smb_share: mySmbShare
          smb_username: ${{ secrets.USERNAME }}
          smb_password: ${{ secrets.PASSWORD }}
          destination_path: contracts

Badge

If you appreciate this github action give it a ⭐ or show off with one of the badges below. Feel free to edit the text or color.

Deployed with SMB Deploy Action

[<img alt="Deployed with SMB Deploy Action" src="https://img.shields.io/badge/Deployed With-SMB DEPLOY ACTION-%3CCOLOR%3E?style=for-the-badge&color=0077b6">](https://github.com/pablo-schmeiser/SMB-Deploy-Action)

FAQ

How do I set a upload timeout?

github has a built-in timeout-minutes option, see customized example below

on: push
name: Publish
jobs:
  deploy:
    name: deploy
    runs-on: ubuntu-latest
    timeout-minutes: 15 # time out after 15 minutes (default is 360 minutes)
    steps:
      ...

Debugging your config locally

This action is a basic wrapper around my @pablo-schmeiser/SMB-Deploy-Action repository. To test your config you can install @pablo-schmeiser/SMB-Deploy-Action and then convert your config to a yml action. Settings are one-to-one, this action is only a wrapper.

Contributing to this project

To test this action locally you will need to setup docker and act to run a environment similar to the one github uses for actions.

About

Automate deploying websites and more to SMB shares with this GitHub action.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors