Skip to content

Commit

Permalink
Merge pull request #3 from Dafnik/feature/readme-enhancements
Browse files Browse the repository at this point in the history
feat: text enhancements
  • Loading branch information
Dafnik authored May 22, 2024
2 parents 3a6727f + 00b05fa commit 40fc21f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
Binary file added .github/ssp/pr-comment-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 18 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
# Static Site Preview (SSP)
Deploy static site previews to a self-hosted server via ssh.
Deploy static site previews via ssh.

## Please note that this is in no way a secure solution for hosting static site previews.
- You should only use this in repositories you **DO NOT** trust.
## NOTICE
Please note that this is in no way a secure solution for hosting static site previews.
- You should only use this in repositories you **DO** trust.
- You should only use this on a server
- you **DO NOT** care about.
- where you **DO NOT** have sensitive information stored.
- where you **DO NOT** run other sensitive services.
- Unless you jail the specific ssh user, you are allowing a GitHub Action full ssh access to your server.
- You allow any other repository with access to the same preview server to overwrite each others previews. (This should not happen under normal circumstances, as the GitHub Action uses a hash of repository name + pull request number)
- You allow any other repository with access to the same preview server to overwrite each other's previews.

(Though this should not happen under normal circumstances, as the GitHub Action uses a hash of repository name + pull request number)

## Screenshots
### GitHub Pull Request comment
![GitHub Pull Request comment][github-pull-request-comment-screenshot]

## Usage

Expand All @@ -21,14 +28,16 @@ on: [pull_request]
jobs:
deploy:
runs-on: ubuntu-latest

permissions:
pull-requests: write
pull-requests: write # needed for preview pull request comment
actions: read

# Deploy to the preview environment
environment:
name: preview-${{ github.event.number }}
url: ${{ steps.deploy-preview.outputs.url }}

steps:
- uses: actions/download-artifact@v4
with:
Expand Down Expand Up @@ -63,12 +72,10 @@ jobs:
Furthermore, see [action.yml](action.yml)

### NGINX Configuration
Previews are going to stored in the `/var/www/preview` directory.
```
/etc/nginx/site-enabled/preview
Previews are stored in the `/var/www/preview` directory by default.
```
# /etc/nginx/site-enabled/preview
```
server {
listen 80;
server_name *.preview.xyz.abc;
Expand Down Expand Up @@ -120,7 +127,7 @@ server {
```

### Cleanup cron job
Delete previews with not activity in the last 30 days.
Delete previews with no activity in the last 30 days.
```bash
# /home/ubuntu/cronDeleteUnusedPreviews.sh

Expand Down Expand Up @@ -163,3 +170,4 @@ The scripts and documentation in this project are released under the [MIT Licens
[draft-release]: .github/workflows/draft-release.yml
[release]: .github/workflows/release.yml
[release-workflow-runs]: https://github.com/dafnik/ssp/actions/workflows/release.yml
[github-pull-request-comment-screenshot]: .github/ssp/pr-comment-screenshot.png
12 changes: 6 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: 'Static Site Preview (SSP)'
description: 'Deploy static site previews to a self-hosted server via ssh'
description: 'Deploy static site previews via ssh.'
author: "Dafnik"
branding:
icon: 'arrow-down-circle'
icon: 'truck'
color: 'purple'

inputs:
Expand Down Expand Up @@ -37,8 +37,8 @@ runs:
shell: bash
if: github.event_name != 'pull_request'
run : |
echo "static-site-preview can only be run from pull request"
echo "Check for pull request like this"
echo "SSP can only be run from pull requests, stopping..."
echo "Check for pull request in the action step like this"
echo "if: github.event_name == 'pull_request'"
exit 1
Expand Down Expand Up @@ -66,7 +66,7 @@ runs:
shell: bash
run: |
if [ -z "${{ steps.hash.outputs.md5 }}" ]; then
echo "MD5 hash is empty. Failing the workflow."
echo "MD5 hash generation failed, stopping..."
exit 1
else
echo "MD5 hash: ${{ steps.hash.outputs.md5 }}"
Expand All @@ -88,7 +88,7 @@ runs:
uses: marocchino/sticky-pull-request-comment@v2
with:
message: |
This pull request has been automatically deployed using Dafnik's static site preview (SSP) service.
This pull request has been automatically deployed using Dafnik's static site preview (SSP) action.
[Learn more](https://github.com/Dafnik/ssp).
🔎 **Commit:** ${{ github.sha }}
Expand Down

0 comments on commit 40fc21f

Please sign in to comment.