-
Notifications
You must be signed in to change notification settings - Fork 7
69 lines (57 loc) · 2.01 KB
/
Copy pathdeploy.yml
File metadata and controls
69 lines (57 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Deploy to Raspberry Pi
on:
workflow_run:
workflows: ["Build and Push Docker Images"]
types:
- completed
workflow_dispatch:
jobs:
deploy:
runs-on: [self-hosted, "${{ matrix.runner}}" ]
# Only deploy if the build workflow succeeded
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
strategy:
matrix:
include:
- runner: kitchen
airplay_name: "Kitchen HomeSpeaker"
- runner: upstairs
airplay_name: "Upstairs HomeSpeaker"
steps:
- uses: actions/checkout@v4
- name: Log in to GitHub Container Registry
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Renew Tailscale certificate
run: |
cd ~/cert
HOSTNAME=$(hostname)
sudo tailscale cert ${HOSTNAME}.boston-cloud.ts.net
sudo openssl pkcs12 -export -out certificate.pfx -inkey ${HOSTNAME}.boston-cloud.ts.net.key -in ${HOSTNAME}.boston-cloud.ts.net.crt -passout pass:
sudo chown piuser. certificate.pfx
- name: Write environment variables to .env file
env:
GOVEE_API_KEY: ${{ secrets.GOVEE_API_KEY }}
AIRPLAY_NAME: "${{ matrix.airplay_name }}"
run: |
cat > .env << EOF
GOVEE_API_KEY=${GOVEE_API_KEY}
AIRPLAY_NAME=${AIRPLAY_NAME}
HOMESPEAKER_IMAGE=ghcr.io/${{ github.repository_owner }}/homespeaker:latest
EOF
- name: Pull latest images
run: docker-compose pull
- name: Stop containers
run: docker-compose down
- name: Start containers (no build!)
run: docker-compose up -d --remove-orphans
- name: Wait for services to be ready
run: sleep 25
- name: Refresh browser on touchscreen
run: |
export DISPLAY=:0
xdotool key F5
continue-on-error: true
- name: Clean up old images
run: docker image prune -af --filter "until=168h"
continue-on-error: true