Skip to content

cssnr/push-artifacts-action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tags GitHub Release Version GitHub Last Commit Codeberg Last Commit GitHub Top Language GitHub Org Stars Discord

Push Artifacts Action

This is really just a POC, but works and is in use. While it does rsync artifacts to a remote host, it is designed for screenshots because it creates a swiper.js index.html with all the files synced and if served from a web server can be viewed in the browser.

Will rsync the source (directory in the build) to host@user with pass on port to dest remote directory and append the GITHUB_REPOSITORY (org/repo) followed by GITHUB_RUN_NUMBER then GITHUB_RUN_ATTEMPT and optionally send a notification to a Discord webhook or comment on the PR prepending the webhost to the path.

Warning

This action and this GitHub repository will soon be renamed before v1.0.0 is published.

Inputs

input required default description
source Yes - Source Directory
dest No /static Destination Directory *
host Yes - RSYNC Host
user Yes - RSYNC User
pass Yes - RSYNC Pass
port No 22 RSYNC Port
webhost No - HTTP Web Host for URL *
webhook No - Discord Webhook *
token No - ${{ secrets.GITHUB_TOKEN }}

dest - Remote destination directory that should be the root of your web server directory. The full remote path will be {dest}/{owner}/{repo}/{run#}

webhost - Web host where the dest is available at. The full URL will be {webhost}/{owner}/{repo}/{run#}

webhook - A Discord Webhook URL that if provided will be posted to.

token - A GITHUB_TOKEN that if provided will be used to comment on the Pull Request.

For full details see: src/main.sh

- name: 'Push Artifacts'
  uses: cssnr/push-artifacts-action@master
  with:
      source: 'tests/screenshots'
      dest: '/static'
      host: ${{ secrets.RSYNC_HOST }}
      user: ${{ secrets.RSYNC_USER }}
      pass: ${{ secrets.RSYNC_PASS }}
      port: ${{ secrets.RSYNC_PORT }}
      webhost: 'https://example.com'
      webhook: ${{ secrets.DISCORD_WEBHOOK }}
      token: ${{ secrets.GITHUB_TOKEN }}

Examples

name: 'Push Artifacts Test'

on:
    push:
        branches:
            - master
    pull_request:
        branches:
            - master

jobs:
    test:
        name: 'Test'
        runs-on: ubuntu-latest
        timeout-minutes: 5

        steps:
            - name: 'Checkout'
              uses: actions/checkout@v4

            - name: 'Push Artifacts'
              uses: cssnr/push-artifacts-action@master
              with:
                  source: 'tests/screenshots'
                  dest: '/static'
                  host: ${{ secrets.RSYNC_HOST }}
                  user: ${{ secrets.RSYNC_USER }}
                  pass: ${{ secrets.RSYNC_PASS }}
                  port: ${{ secrets.RSYNC_PORT }}
                  webhost: 'https://example.com'
                  webhook: ${{ secrets.DISCORD_WEBHOOK }}
                  token: ${{ secrets.GITHUB_TOKEN }}

To see this used in actual workflows, check out these examples:
https://github.com/django-files/django-files/blob/master/.github/workflows/test.yaml
https://github.com/cssnr/link-extractor/blob/master/.github/workflows/test.yaml

Support

For general help or to request a feature, see:

If you are experiencing an issue/bug or getting unexpected results, you can:

Contributing

Currently, the best way to contribute to this project is to star this project on GitHub.

Additionally, you can support other GitHub Actions I have published:

For a full list of current projects to support visit: https://cssnr.github.io/