Skip to content

cssnr/push-artifacts-action

Repository files navigation

GitHub Tag Major GitHub Tag Minor GitHub Release Version Workflow Release Workflow Test Workflow Lint GitHub Last Commit Codeberg Last Commit GitHub Top Language GitHub repo size GitHub Discussions GitHub Forks GitHub Repo Stars 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 Req. Default Input Description
source Yes - Source Directory
dest - /static Destination Directory *
host Yes - RSYNC Host
user Yes - RSYNC User
pass Yes - RSYNC Pass
port - 22 RSYNC Port
webhost - - HTTP Web Host for URL *
webhook - - Discord Webhook *
comment - true Add a Comment to PRs
token - - For use with a PAT

For more details see action.yml and src/main.sh.

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.

- 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 }}

Permissions

This action requires the following permissions to add pull request comments:

permissions:
  pull-requests: write

Permissions documentation for Workflows and Actions.

Outputs

Output Output Description
url Full Screen Shots URL

You must provide the webhost input for this to function properly.

Examples

name: 'Push Artifacts Test'

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

jobs:
  test:
    name: 'Test'
    runs-on: ubuntu-latest
    timeout-minutes: 5
    permissions:
      pull-requests: write

    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

For more examples, you can check out other projects using this action:
https://github.com/cssnr/push-artifacts-action/network/dependents

Tags

The following rolling tags are maintained.

Version Tag Rolling Bugs Feat. Name Target Example
GitHub Tag Major Major vN.x.x vN
GitHub Tag Minor Minor vN.N.x vN.N
GitHub Release Micro vN.N.N vN.N.N

You can view the release notes for each version on the releases page.

The Major tag is recommended. It is the most up-to-date and always backwards compatible. Breaking changes would result in a Major version bump. At a minimum you should use a Minor tag.

Support

For general help or to request a feature, see:

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

For more information, see the CSSNR SUPPORT.md.

Contributing

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

For more information, see the CSSNR CONTRIBUTING.md.

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

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