Repository navigation
127 lines (105 loc) · 3.52 KB
/
Copy pathrelease.yml
File metadata and controls
127 lines (105 loc) · 3.52 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
name: Release Models
run-name: Release Models ${{ github.ref_name }}
on:
push:
tags:
# only even-minor tags are real releases; odd-minor tags are dev
# anchors for git describe and must not fire this workflow
- 'release-[0-9]+.[02468].[0-9]+'
- 'release-[0-9]+.[02468].[0-9]+.[0-9]+'
workflow_dispatch:
permissions:
contents: write
jobs:
discover:
# auto on upstream only; forks opt in via the Actions UI
if: github.repository == 'darktable-org/darktable-ai' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
outputs:
models: ${{ steps.find.outputs.models }}
steps:
- uses: actions/checkout@v6
with:
submodules: true
- uses: astral-sh/setup-uv@v8.1.0
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- id: find
name: Discover models
run: |
models=$(uv run dtai list --json-output)
echo "models=$models" >> "$GITHUB_OUTPUT"
build:
needs: discover
if: github.repository == 'darktable-org/darktable-ai' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.discover.outputs.models) }}
steps:
- uses: actions/checkout@v6
with:
submodules: true
- uses: astral-sh/setup-uv@v8.1.0
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install dependencies
run: uv sync --group ${{ matrix.dep_group }}
- name: Download checkpoints
run: uv run dtai setup ${{ matrix.id }}
- name: Convert to ONNX
run: uv run dtai convert ${{ matrix.id }}
- name: Validate output
run: uv run dtai validate ${{ matrix.id }}
- name: Package model
run: uv run dtai package ${{ matrix.id }}
- uses: actions/upload-artifact@v7
with:
name: ${{ matrix.id }}
path: output/${{ matrix.id }}.dtmodel
publish:
needs: build
# require a release-* tag AND every matrix member to succeed;
# dispatch from a branch builds but doesn't publish (test runs)
if: ${{ !cancelled() && needs.build.result == 'success' && startsWith(github.ref, 'refs/tags/release-') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v8.1.0
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- uses: actions/download-artifact@v8
with:
path: artifacts
- name: Generate versions.json (with SHAs)
run: uv run dtai versions --artifacts-dir artifacts
- name: Resolve version from tag
id: ver
run: |
VERSION="${GITHUB_REF_NAME#release-}"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Publish release
uses: ncipollo/release-action@v1.21.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: ${{ github.ref_name }}
name: "release ${{ steps.ver.outputs.version }}"
bodyFile: RELEASE_NOTES.md
draft: true # maintainer reviews and publishes from the UI
artifacts: |
artifacts/*/*.dtmodel
output/versions.json