-
Notifications
You must be signed in to change notification settings - Fork 1
171 lines (153 loc) · 5.98 KB
/
publish.yml
File metadata and controls
171 lines (153 loc) · 5.98 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.
name: Publish Docker image
on:
release:
types: [published]
jobs:
test_smart_crop_video:
name: Test smart-crop-video before publishing
runs-on: ubuntu-latest
if: startsWith(github.event.release.tag_name, 'smart-crop-video-v')
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
cd smart-crop-video
pip install -r tests/requirements.txt
playwright install chromium
- name: Run container tests
run: |
cd smart-crop-video
pytest tests/test_container.py -v --tb=short
timeout-minutes: 15
- name: Run basic API tests
run: |
cd smart-crop-video
# Run only the fast API tests, skip the long-running ones
pytest tests/test_api.py -v --tb=short -k "not candidates and not preview and not select and not acceleration and not scene"
timeout-minutes: 10
push_to_registry:
needs: test_smart_crop_video
if: |
always() &&
(needs.test_smart_crop_video.result == 'success' ||
needs.test_smart_crop_video.result == 'skipped')
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Determine which utilities to build
id: utils
run: |
TAG_NAME="${{ github.event.release.tag_name }}"
# Determine which utilities to build based on tag prefix
if [[ $TAG_NAME == network-mapper-v* ]] || [[ $TAG_NAME == v* ]]; then
echo "build_network_mapper=true" >> $GITHUB_OUTPUT
else
echo "build_network_mapper=false" >> $GITHUB_OUTPUT
fi
if [[ $TAG_NAME == smart-crop-video-v* ]]; then
echo "build_smart_crop=true" >> $GITHUB_OUTPUT
else
echo "build_smart_crop=false" >> $GITHUB_OUTPUT
fi
if [[ $TAG_NAME == mov-to-gif-v* ]]; then
echo "build_mov_to_gif=true" >> $GITHUB_OUTPUT
else
echo "build_mov_to_gif=false" >> $GITHUB_OUTPUT
fi
if [[ $TAG_NAME == update-pdf-v* ]]; then
echo "build_update_pdf=true" >> $GITHUB_OUTPUT
else
echo "build_update_pdf=false" >> $GITHUB_OUTPUT
fi
if [[ $TAG_NAME == stress-v* ]]; then
echo "build_stress=true" >> $GITHUB_OUTPUT
else
echo "build_stress=false" >> $GITHUB_OUTPUT
fi
if [[ $TAG_NAME == onedrive-backup-v* ]]; then
echo "build_onedrive_backup=true" >> $GITHUB_OUTPUT
else
echo "build_onedrive_backup=false" >> $GITHUB_OUTPUT
fi
if [[ $TAG_NAME == unraid-util-v* ]]; then
echo "build_unraid_util=true" >> $GITHUB_OUTPUT
else
echo "build_unraid_util=false" >> $GITHUB_OUTPUT
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: nickborgers
password: ${{ secrets.DOCKER_HUB_PAT }}
- name: Build and push mov-to-gif
if: steps.utils.outputs.build_mov_to_gif == 'true'
uses: docker/build-push-action@v5
with:
context: ./mov-to-gif/
file: ./mov-to-gif/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: nickborgers/mov-to-gif:latest,nickborgers/mov-to-gif:${{ github.ref_name }}
- name: Build and push update-pdf
if: steps.utils.outputs.build_update_pdf == 'true'
uses: docker/build-push-action@v5
with:
context: ./update-pdf/
file: ./update-pdf/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: nickborgers/update-pdf:latest,nickborgers/update-pdf:${{ github.ref_name }}
- name: Build and push stress
if: steps.utils.outputs.build_stress == 'true'
uses: docker/build-push-action@v5
with:
context: ./stress/
file: ./stress/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: nickborgers/stress:latest,nickborgers/stress:${{ github.ref_name }}
- name: Build and push onedrive-backup
if: steps.utils.outputs.build_onedrive_backup == 'true'
uses: docker/build-push-action@v5
with:
context: ./onedrive-backup/
file: ./onedrive-backup/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: nickborgers/onedrive-backup:latest,nickborgers/onedrive-backup:${{ github.ref_name }}
- name: Build and push unraid-util
if: steps.utils.outputs.build_unraid_util == 'true'
uses: docker/build-push-action@v5
with:
context: ./unraid-util/
file: ./unraid-util/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: nickborgers/unraid-util:latest,nickborgers/unraid-util:${{ github.ref_name }}
- name: Build and push smart-crop-video
if: steps.utils.outputs.build_smart_crop == 'true'
uses: docker/build-push-action@v5
with:
context: ./smart-crop-video/
file: ./smart-crop-video/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: nickborgers/smart-crop-video:latest,nickborgers/smart-crop-video:${{ github.ref_name }}