~

{'title': '2020_09_09_github_actions.brrrr', 'date': '2020-09-09', 'tags': 'gnu/linux, nginx, github', 'type': 'post'}

github actions go brrr

  1. Figure out your FTP thing. In my case it was downloading vsftpd, tinkering with the /etc/vsftpd.conf to allow connections, and enabling the service.

    $ sudo apt install vsftpd
    $ sudo vim /etc/vsftpd.conf
    $ sudo systemctl start vsftpd
    $ sudo systemctl enable vstfpd
    
  2. Create account for my website:

    $ sudo useradd -s /bin/bash -d /home/coolwebsite/ -m coolwebsite
    $ sudo passwd coolwebsite
    
  3. I just linked the home directory straight to the /var/www/exception.lt. I have no idea if this is the correct or even sane way to do this! This implies you have an NGINX site already running for this directory. I already have one, so there is no step to configure your website.

    $ sudo ln -s /home/coolwebsite/ /var/www/exception.lt
    
  4. Create action. In my case, it does lint my generator before doing FTP transfer. Feel free to skip that. Also, I haven’t filtered anything, it just yeets the whole repository to the server and you can access everything you see in the repo [1]. Now I just yeet all data needed for a website to html/ and leave out the scripts and build files out of the webserver. Script has to be updated a bit:

    name: lint-and-ftp-deploy
    on:
     push:
       branches: [ master ]
     pull_request:
       branches: [ master ]
    
    jobs:
     lint:
       name: Lint with Black.
       runs-on: ubuntu-latest
       steps:
       - uses: actions/checkout@v2
       - name: Set up Python 3.8
         uses: actions/setup-python@v2
         with:
           python-version: '3.8'
       - name: Install dependencies.
         run: |
           python -m pip install --upgrade pip
           pip install -r requirements_test.txt
       - name: Fix style with Black.
         run: make lint
    
     deploy:
       name: Deploy to my VPS.
       runs-on: ubuntu-latest
       steps:
       - uses: actions/checkout@v2
       - name: Transfer with ftp.
         uses: sebastianpopp/ftp-action@releases/v2
         with:
           host: ${{ secrets.FTP_SERVER }}
           user: ${{ secrets.FTP_USERNAME }}
           password: ${{ secrets.FTP_PASSWORD }}
           # Only html/ is transferred.
           localDir: "html/"
    
  5. On push to master, you will have that Netlify experience. No need to ssh into your VPS and manually pull your repo. It will be done for you. Now you are one step closer to that full static-page-netlify-jekyll experience.


[1]

image-20200909215447934