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.
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 }}
This action requires the following permissions to add pull request comments:
permissions:
pull-requests: write
Permissions documentation for Workflows and Actions.
Output | Output Description |
---|---|
url | Full Screen Shots URL |
You must provide the webhost
input for this to function properly.
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
The following rolling tags are maintained.
Version Tag | Rolling | Bugs | Feat. | Name | Target | Example |
---|---|---|---|---|---|---|
✅ | ✅ | ✅ | Major | vN.x.x |
vN |
|
✅ | ✅ | ❌ | Minor | vN.N.x |
vN.N |
|
❌ | ❌ | ❌ | 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.
For general help or to request a feature, see:
- Q&A Discussion: https://github.com/cssnr/push-artifacts-action/discussions/categories/q-a
- Request a Feature: https://github.com/cssnr/push-artifacts-action/discussions/categories/feature-requests
If you are experiencing an issue/bug or getting unexpected results, you can:
- Report an Issue: https://github.com/cssnr/push-artifacts-action/issues
- Chat with us on Discord: https://discord.gg/wXy6m2X8wY
- Provide General Feedback: https://cssnr.github.io/feedback/
For more information, see the CSSNR SUPPORT.md.
Please consider making a donation to support the development of this project and additional open source projects.
If you would like to submit a PR, please review the CONTRIBUTING.md.
Additionally, you can support other GitHub Actions I have published:
- Stack Deploy Action
- Portainer Stack Deploy
- VirusTotal Action
- Mirror Repository Action
- Update Version Tags Action
- Update JSON Value Action
- Parse Issue Form Action
- Cloudflare Purge Cache Action
- Mozilla Addon Update Action
- Docker Tags Action
- Package Changelog Action
- NPM Outdated Check Action
- Label Creator Action
- Algolia Crawler Action
- Upload Release Action
- Check Build Action
- Web Request Action
Unpublished Actions ❔
These actions' are not published on the Marketplace, but may be useful.
Generic Actions:
- cssnr/draft-release-action - Keep a draft release ready to publish.
- cssnr/env-json-action - Convert env file to json or vice versa.
- cssnr/get-commit-action - Get the current commit with full details.
Specific Actions:
- cssnr/push-artifacts-action - Sync's artifacts to a remote host.
- smashedr/update-release-notes-action - Update release notes.
Action Templates 📝
These are basic actions' templates that I use for creating new actions.
- js-test-action - JavaScript
- py-test-action - Python
- ts-test-action - TypeScript
- docker-test-action - Docker Image
Note: The docker-action
template runs from, builds for, and pushes images to GitHub Container Registry.
For a full list of current projects to support visit: https://cssnr.github.io/