-
-
Notifications
You must be signed in to change notification settings - Fork 880
137 lines (118 loc) · 5.1 KB
/
Copy pathnightly.yml
File metadata and controls
137 lines (118 loc) · 5.1 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
name: Nightly
on:
schedule:
# Every day at 02:00 UTC
- cron: "0 2 * * *"
workflow_dispatch:
# Cancel any in-progress nightly run if a new one is triggered
concurrency:
group: nightly
cancel-in-progress: true
jobs:
# ───────────────────────────────────────────────
# 1. Build & archive (archives created inside each build workflow)
# ───────────────────────────────────────────────
build-linux:
uses: ./.github/workflows/build-linux.yml
build-windows:
uses: ./.github/workflows/build-windows.yml
# ───────────────────────────────────────────────
# 2. Publish to the "nightly" GitHub Release
# ───────────────────────────────────────────────
publish-nightly:
needs: [build-linux, build-windows]
runs-on: ubuntu-latest
permissions:
contents: write # required to create/edit releases and push tags
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # full history for changelog
- name: Download Linux package
uses: actions/download-artifact@v4
with:
name: linux-package
path: dist
- name: Download Windows package
uses: actions/download-artifact@v4
with:
name: windows-package
path: dist
# ── Metadata ────────────────────────────────
- name: Compute release metadata
id: meta
run: |
SHORT_SHA=$(git rev-parse --short=8 HEAD)
FULL_SHA=$(git rev-parse HEAD)
NOW=$(date -u +'%Y-%m-%d %H:%M UTC')
BUILD_LABEL=$(date -u +%Y%m%d)-${SHORT_SHA}
echo "date=$(date -u +%Y-%m-%d)" >> $GITHUB_OUTPUT
echo "short_sha=${SHORT_SHA}" >> $GITHUB_OUTPUT
echo "full_sha=${FULL_SHA}" >> $GITHUB_OUTPUT
echo "now=${NOW}" >> $GITHUB_OUTPUT
echo "build_label=${BUILD_LABEL}" >> $GITHUB_OUTPUT
# ── Ensure release exists ────────────────────
- name: Ensure nightly release exists
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if ! gh release view nightly --repo "${{ github.repository }}" > /dev/null 2>&1; then
gh release create nightly \
--repo "${{ github.repository }}" \
--title "Nightly Build" \
--notes "Nightly build — will be updated by CI." \
--prerelease
fi
# ── Delete stale assets ──────────────────────
- name: Delete existing release assets
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release view nightly \
--repo "$GITHUB_REPOSITORY" \
--json assets \
--jq '.assets[].name' \
| while read -r ASSET; do
echo " → Deleting asset: $ASSET"
gh release delete-asset nightly "$ASSET" \
--repo "$GITHUB_REPOSITORY" --yes
done
# ── Upload fresh assets ──────────────────────
- name: Upload release assets
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload nightly dist/* \
--repo "${{ github.repository }}" \
--clobber
# ── Write release notes to file ──────────────
- name: Write release notes
run: |
NOW="${{ steps.meta.outputs.now }}"
SHORT_SHA="${{ steps.meta.outputs.short_sha }}"
BUILD_LABEL="${{ steps.meta.outputs.build_label }}"
FULL_SHA="${{ steps.meta.outputs.full_sha }}"
cat > nightly_release_notes.md << EOF
> [!WARNING]
> **Automated nightly build** from the \`develop\` branch. May be unstable.
| | |
|---|---|
| Date | ${NOW} |
| Commit | [${SHORT_SHA}](https://github.com/${{ github.repository }}/commit/${{ github.sha }}) |
| Branch | \`develop\` |
### Assets
| File | Platform |
|------|----------|
| \`AliceVision-nightly-${BUILD_LABEL}-linux.tar.gz\` | Linux (Rocky 9, CUDA 12.1.1) |
| \`AliceVision-nightly-${BUILD_LABEL}-windows.zip\` | Windows |
EOF
# ── Update release from file ──────────────────
- name: Update release notes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release edit nightly \
--repo "${{ github.repository }}" \
--title "Nightly Build (${{ steps.meta.outputs.build_label }})" \
--notes-file nightly_release_notes.md \
--prerelease