2023-04-01 22:21:52 +02:00
|
|
|
variables:
|
|
|
|
- &all_events ["push", "cron", "deployment", "manual"]
|
|
|
|
|
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: |
|
|
|
|
CI_PIPELINE_EVENT in ["push", "cron", "deployment", "manual"]
|
2023-07-30 16:27:06 +02:00
|
|
|
and ((CI_COMMIT_BRANCH != CI_REPO_DEFAULT_BRANCH) == ("${TYPE}" == "prod"))
|
2023-04-01 21:57:51 +02:00
|
|
|
|
|
|
|
pipeline:
|
|
|
|
- name: check
|
|
|
|
image: bash
|
|
|
|
commands:
|
2023-07-30 16:27:06 +02:00
|
|
|
- nix shell pkgs#coreutils --command env
|
2023-04-01 21:57:51 +02:00
|
|
|
- nix flake check
|
2023-04-01 22:21:52 +02:00
|
|
|
when:
|
|
|
|
event: *all_events
|
2023-04-01 21:57:51 +02:00
|
|
|
|
|
|
|
- name: build (${TYPE})
|
|
|
|
image: bash
|
|
|
|
commands:
|
|
|
|
# If dev, include drafts and future articles, change base URL
|
|
|
|
- nix develop -c make ${MAKE_TARGET}
|
2023-04-01 22:21:52 +02:00
|
|
|
when:
|
|
|
|
event: *all_events
|
2023-04-01 21:57:51 +02:00
|
|
|
|
|
|
|
- name: deploy (${TYPE})
|
|
|
|
image: bash
|
|
|
|
environment:
|
|
|
|
# Trailing slash to synchronize the folder's *content* to the target
|
|
|
|
- SYNC_SOURCE=public/
|
|
|
|
secrets:
|
|
|
|
- source: ssh_key
|
|
|
|
target: sync_key
|
|
|
|
- source: ssh_port
|
|
|
|
target: sync_port
|
|
|
|
- source: ${SSH_TARGET}
|
|
|
|
target: sync_target
|
|
|
|
- source: ssh_user
|
|
|
|
target: sync_username
|
|
|
|
- source: ssh_host
|
|
|
|
target: sync_host
|
|
|
|
commands:
|
|
|
|
- "nix run github:ambroisie/nix-config#drone-rsync"
|
2023-04-01 22:21:52 +02:00
|
|
|
when:
|
|
|
|
event: *all_events
|
2023-04-01 21:57:51 +02:00
|
|
|
|
|
|
|
- name: notify
|
|
|
|
image: bash
|
|
|
|
secrets:
|
|
|
|
- source: matrix_homeserver
|
|
|
|
target: address
|
|
|
|
- source: matrix_password
|
|
|
|
target: pass
|
|
|
|
- source: matrix_roomid
|
|
|
|
target: room
|
|
|
|
- source: matrix_username
|
|
|
|
target: user
|
|
|
|
commands:
|
|
|
|
- nix run github:ambroisie/matrix-notifier
|
|
|
|
when:
|
2023-04-01 22:21:52 +02:00
|
|
|
event: *all_events
|
2023-04-01 21:57:51 +02:00
|
|
|
status:
|
|
|
|
- failure
|
|
|
|
- success
|