Today I spent the whole day at work coding up a completely work-unrelated thing: A deploy pipeline for my website. For every push to the main branch, a webhook triggers a pull and a rebuild of the code. There is also a smol ci pipeline, which runs the tests and checks if they pass. If yes, the webhook is called.
It replaced the bash script I had before which was ssh-ing into my server and manually building the code. It was working fine, but had some limitations. The biggest was that I could only deploy from my laptop. The code was copied using rsync which works fine if you configure it correctly (Narrator: he did not). So I ended up wiping my uploads folder a few times when deploying. Not fun.
The new workflow goes something like this:
flowchart TB A1[git push] --> A2[Forgejo Action] A2 --> A3[webhook] A3 --> A4[build.sh] A4 --> A5[git pull] A5 --> A6[mix build]
This shit is very barebones and probably insecure:
on:
push:
branches:
- main
jobs:
compile:
runs-on: elixir
steps:
- name: Update APT
run: apt update
- name: Install Node.js
run: apt install nodejs -y
- name: Checkout repo
uses: https://data.forgejo.org/actions/checkout@v6
- name: Install Mix Deps
run: mix deps.get
- name: Compile Mix Deps and Setup Database
run: MIX_ENV=test mix ecto.setup
- name: Run Tests
run: mix test
I feel like there could be more done and I just hope there is a better way, but for now, this is crazy cool. I've never used a pipeline like this, so this feels very rocket-science 😆

Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.