22 DE August DE 2020
Usemos scp usando github actions para publicar contenido estático creado por algun generador de sitios estáticos como pelican, jigsaw o gatsby a nuestro servidor.
La manera facíl, sencilla y rápido es con este workflow:
1name: Deploy 2 3on: 4 push: 5 branches: 6 - master # Change this to your default branch 7jobs: 8 build: 9 10 runs-on: ubuntu-latest11 12 steps:13 - uses: actions/checkout@v214 15 - name: Copy file via scp16 uses: appleboy/scp-action@master17 env:18 HOST: ${{ secrets.HOST }}19 USERNAME: ${{ secrets.USERNAME }}20 PORT: ${{ secrets.PORT }}21 KEY: ${{ secrets.SSHKEY }}22 PASSPHRASE: ${{secrets.PASSPHRASE}}23 with:24 source: "."25 target: ${{ secrets.TARGET }}
Hay que crear variables de entornos secretas para los valores que vamos a usar:
HOST
USERNAME
PORT
SSHKEY
PASSPHRASE
Este workflow debe ir en la siguiente ruta: .github/workflows/publish.yml
y listo, al hacer esto cada vez que hagan un push a su rama master se va a publicar automáticamente en su servidor sin problemas.
Nota: Es recomendable tener una SSHKEY dedicada a esta labor únicamente y que no contenga PASSPHRASE, de tenerla tendrán que agregarla en las secrets para que el script pueda funcionar.
Made with ♥️ & 🧉 in Montevideo, Uruguay.
[AC].dev is not affiliated with Laravel or Laravel LLC. Laravel is a Trademark of Taylor Otwell.
Code highlighting provided by Torchlight.
We use cookies!
Hi, this website uses essential cookies to ensure its proper operation and tracking cookies to understand how you interact with it.