-
-
Notifications
You must be signed in to change notification settings - Fork 6
133 lines (112 loc) · 4.11 KB
/
Copy pathrelease.yml
File metadata and controls
133 lines (112 loc) · 4.11 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Release
on:
push:
tags:
- "v*.*.*"
env:
REGISTRY: ghcr.io
IMAGE_PREFIX: ghcr.io/jfmlima/shelly-manager
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Calculate Image Tag (Strip 'v' prefix)
run: |
tag_name="${{ github.ref_name }}"
echo "IMAGE_TAG=${tag_name#v}" >> $GITHUB_ENV
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
name: "🚀 Shelly Manager ${{ github.ref_name }}"
generate_release_notes: true
prerelease: ${{ contains(github.ref_name, '-') }}
body: |
## 🐳 Docker Images
**Available Docker Images:**
- `${{ env.IMAGE_PREFIX }}-api:${{ env.IMAGE_TAG }}`
- `${{ env.IMAGE_PREFIX }}-cli:${{ env.IMAGE_TAG }}`
- `${{ env.IMAGE_PREFIX }}-web:${{ env.IMAGE_TAG }}`
## 🚀 Quick Start
```bash
# Run API server. The -v keeps the database and firmware cache;
# generate the key with: openssl rand -base64 32 | tr '+/' '-_'
docker run -p 8000:8000 \
-e SHELLY_SECRET_KEY="your-generated-key" \
-v shelly-manager-data:/data \
${{ env.IMAGE_PREFIX }}-api:${{ env.IMAGE_TAG }}
# Run CLI tool
docker run --rm ${{ env.IMAGE_PREFIX }}-cli:${{ env.IMAGE_TAG }} --help
# Run Web UI
docker run -p 8080:8080 ${{ env.IMAGE_PREFIX }}-web:${{ env.IMAGE_TAG }}
```
## 📋 What's Changed
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-and-push-all:
runs-on: ubuntu-latest
needs: create-release
strategy:
matrix:
package:
- name: api
dockerfile: packages/api/Dockerfile
context: .
- name: cli
dockerfile: packages/cli/Dockerfile
context: .
- name: web
dockerfile: packages/web/Dockerfile
context: .
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_PREFIX }}-${{ matrix.package.name }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ${{ matrix.package.context }}
file: ${{ matrix.package.dockerfile }}
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
trigger-addon-build:
runs-on: ubuntu-latest
needs: build-and-push-all
steps:
- name: Trigger Home Assistant addon build
run: |
curl -X POST \
-H "Authorization: token ${{ secrets.ADDON_REPO_PAT }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/jfmlima/home-assistant-addons/dispatches \
-d '{"event_type": "shelly-manager-release", "client_payload": {"version": "${{ github.ref_name }}"}}'
trigger-unraid-build:
runs-on: ubuntu-latest
needs: build-and-push-all
steps:
- name: Trigger Unraid templates build
run: |
curl -X POST \
-H "Authorization: token ${{ secrets.ADDON_REPO_PAT }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/jfmlima/unraid-templates/dispatches \
-d '{"event_type": "shelly-manager-release", "client_payload": {"version": "${{ github.ref_name }}"}}'