45 lines
1.4 KiB
YAML
45 lines
1.4 KiB
YAML
name: Build and deploy
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- feature/**
|
|
tags:
|
|
- v*.*.*
|
|
|
|
jobs:
|
|
build:
|
|
uses: dreaded_x/workflows/.gitea/workflows/rust-kubernetes.yaml@876a16d430851fce6241da5440d10545fd0ab06a
|
|
secrets: inherit
|
|
|
|
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: |
|
|
echo "DIGEST = ${{ needs.build.outputs.digest }}"
|
|
docker create \
|
|
--pull always \
|
|
--restart unless-stopped \
|
|
--name automation_rs \
|
|
--network mqtt \
|
|
-e RUST_LOG=automation=debug \
|
|
-e MQTT_PASSWORD=${{ secrets.MQTT_PASSWORD }} \
|
|
-e HUE_TOKEN=${{ secrets.HUE_TOKEN }} \
|
|
-e 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
|