2023-04-01 21:57:51 +02:00
|
|
|
labels:
|
2023-07-30 15:27:16 +02:00
|
|
|
backend: local
|
2023-04-01 21:57:51 +02:00
|
|
|
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- TYPE: dev
|
|
|
|
MAKE_TARGET: build-dev
|
|
|
|
SSH_TARGET: ssh_target_dev
|
|
|
|
- TYPE: prod
|
|
|
|
MAKE_TARGET: build-prod
|
|
|
|
SSH_TARGET: ssh_target
|
|
|
|
|
|
|
|
# Run the correct matrix build on the correct branch
|
|
|
|
when:
|
|
|
|
evaluate: |
|
2023-11-18 21:02:59 +01:00
|
|
|
((CI_COMMIT_BRANCH == CI_REPO_DEFAULT_BRANCH) == ("${TYPE}" == "prod"))
|
2023-04-01 21:57:51 +02:00
|
|
|
|
2023-11-18 21:03:51 +01:00
|
|
|
steps:
|
2023-04-01 21:57:51 +02:00
|
|
|
- name: check
|
|
|
|
image: bash
|
|
|
|
commands:
|
|
|
|
- nix flake check
|
|
|
|
|
|
|
|
- name: build (${TYPE})
|
|
|
|
image: bash
|
|
|
|
commands:
|
|
|
|
# If dev, include drafts and future articles, change base URL
|
|
|
|
- nix develop -c make ${MAKE_TARGET}
|
|
|
|
|
|
|
|
- name: deploy (${TYPE})
|
|
|
|
image: bash
|
|
|
|
environment:
|
2024-06-27 12:41:25 +02:00
|
|
|
# Trailing slash to synchronize the folder's *content* to the target
|
|
|
|
SYNC_SOURCE: public/
|
|
|
|
SYNC_KEY:
|
|
|
|
from_secret: ssh_key
|
|
|
|
SYNC_PORT:
|
|
|
|
from_secret: ssh_port
|
|
|
|
SYNC_TARGET:
|
|
|
|
from_secret: ${SSH_TARGET}
|
|
|
|
SYNC_USERNAME:
|
|
|
|
from_secret: ssh_user
|
|
|
|
SYNC_HOST:
|
|
|
|
from_secret: ssh_host
|
2023-04-01 21:57:51 +02:00
|
|
|
commands:
|
|
|
|
- "nix run github:ambroisie/nix-config#drone-rsync"
|
|
|
|
|
|
|
|
- name: notify
|
|
|
|
image: bash
|
2024-06-27 12:41:25 +02:00
|
|
|
environment:
|
|
|
|
ADDRESS:
|
|
|
|
from_secret: matrix_homeserver
|
|
|
|
ROOM:
|
|
|
|
from_secret: matrix_roomid
|
|
|
|
USER:
|
|
|
|
from_secret: matrix_username
|
|
|
|
PASS:
|
|
|
|
from_secret: matrix_password
|
2023-04-01 21:57:51 +02:00
|
|
|
commands:
|
|
|
|
- nix run github:ambroisie/matrix-notifier
|
|
|
|
when:
|
|
|
|
status:
|
|
|
|
- failure
|
|
|
|
- success
|