Files
automation_rs/.gitea/workflows/build.yml
Dreaded_X 8bb17e1440 feat(config)!: Reworked how configuration is loaded
The environment variable `AUTOMATION_CONFIG` has been renamed to
`AUTOMATION__ENTRYPOINT` and can now also be set in `automation.toml` by
specifying:
```
automation = "<path>"
```

Directly accessing the environment variables in lua in no longer
possible. To pass in configuration or secrets you can now instead make
use of the `variables` and `secrets` modules.

To set values in these modules you can either specify them in
`automation.toml`:
```
[variables]
<name> = <value>

[secrets]
<name> = <value>
```
Note that these values will get converted to a string.

You can also specify the environment variables
`AUTOMATION__VARIABLES__<name>` and `AUTOMATION__SECRETS__<name>` to
set variables and secrets respectively. By adding the suffix `__FILE` to
the environment variable name the contents of a file can be loaded into
the variable or secret.

Note that variables and secrets are identical in functionality and the
name difference exists purely to make it clear that secret values are
meant to be kept secret.
2025-09-05 04:48:00 +02:00

46 lines
1.5 KiB
YAML

name: Build and deploy
on:
push:
branches:
- master
- feature/**
tags:
- v*.*.*
jobs:
build:
uses: dreaded_x/workflows/.gitea/workflows/rust-kubernetes.yaml@22ee0c1788a8d2157db87d6a6f8dbe520fe48592
secrets: inherit
with:
upload_manifests: false
deploy:
name: Deploy container
runs-on: ubuntu-latest
container: catthehacker/ubuntu:act-latest
needs: build
if: gitea.ref == 'refs/heads/master'
steps:
- name: Stop and remove current container
run: |
docker stop automation_rs || true
docker rm automation_rs || true
- name: Create container
run: |
docker create \
--pull always \
--restart unless-stopped \
--name automation_rs \
--network mqtt \
-e RUST_LOG=automation=debug \
-e AUTOMATION__SECRETS__MQTT_PASSWORD=${{ secrets.MQTT_PASSWORD }} \
-e AUTOMATION__SECRETS__HUE_TOKEN=${{ secrets.HUE_TOKEN }} \
-e AUTOMATION__SECRETS__NTFY_TOPIC=${{ secrets.NTFY_TOPIC }} \
git.huizinga.dev/dreaded_x/automation_rs@${{ needs.build.outputs.digest }}
docker network connect web automation_rs
- name: Start container
run: docker start automation_rs