Github Action to publish static sites to pgs.sh.
user
: SSH User namekey
: Private keysrc
: Source dir to deployproject
: Project namepromote
: Once the files have been uploaded toproject
we will promote it by symbolically linking this project to itretain
: Removes all projects except the last (3) recently updated projects that match prefix provided
You will need to copy your ssh private key into a secret in your github repo. This means your key will be accessible from github. It is highly recommended that you create a separate key specifically for pico services that way you can quickly log into pico and remove the key if there's a breach on github.
https://pico.sh/faq#can-i-associate-multiple-ssh-keypairs-to-a-single-account
name: ci
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
name: Build and Deploy
steps:
- uses: actions/checkout@master
- name: publish to pgs
uses: picosh/pgs-action@v3
with:
user: erock
key: ${{ secrets.PRIVATE_KEY }}
# trailing slash is important (we use rsync)
src: './public/'
# update or create a new project on-the-fly
project: 'neovimcraft'
name: ci
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
name: Build and Deploy
steps:
- uses: actions/checkout@master
- name: Set outputs
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: publish to pgs
uses: picosh/pgs-action@v3
with:
user: erock
key: ${{ secrets.PRIVATE_KEY }}
# trailing slash is important (we use rsync)
src: './public/'
# create a new project on-the-fly using git commit hash
project: 'neovimcraft-${{ steps.vars.outputs.sha_short }}'
# once the files have been uploaded to the project above, promote the
# production project by symbolically linking to the project we just created
promote: 'neovimcraft'
# keep the latest (N) updated projects matching prefix provided and delete the rest
retain: 'neovimcraft-'
# retention policy: num of recently updated projects to keep
retain_num: 1