-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
103 lines (85 loc) · 3.21 KB
/
nightly.yml
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
name: Nightly build
run-name: Nightly build
on:
workflow_call:
inputs:
cura_conan_version:
default: ''
required: true
type: string
release_tag:
default: ''
required: true
type: string
caller_workflow:
default: ''
required: true
type: string
jobs:
create-installers:
name: Create installers
id: create-installers
# FIXME: Use main once merged
uses: ultimaker/cura/github/workflows/installers.yml@CURA-11622_conan_v2
with:
cura_conan_version: ${{ inputs.cura_conan_version }}
secrets: inherit
update-nightly-release:
runs-on: ubuntu-latest
needs: [ create-installers ]
steps:
- name: Download installers jobs artifacts
uses: actions/download-artifact@v4
with:
path: installers
merge-multiple: true
- name: Rename the installers
id: rename-installers
shell: python
working-directory: installers
run: |
import os
first_file = True
for file in os.listdir("."):
if file.startswith("UltiMaker-Cura-"):
# Find the commit tag, and replace it with "nightly"
index_plus = file.index("+")
file_start = file[:index_plus]
file_end = file[index_plus:]
file_end = file_end[file_end.index("-")+1:]
new_file_name = f"{file_start}-nightly-{file_end}"
os.rename(file, new_file_name)
if first_file:
first_file = False
short_version = file_start.split("-")[2]
short_version = ".".join(short_version.split(".")[:2])
with open(os.environ["GITHUB_OUTPUT"], "a") as github_output:
github_output.write(f"cura_version={file_start}\n")
github_output.write(f"short_version={file_start}\n")
- name: create the release notes
shell: python
run: |
import os
import datetime
from jinja2 import Template
with open(".github/workflows/nightly_release_notes.md.jinja", "r") as f:
release_notes = Template(f.read())
short_version = "${{ steps.rename-installers.outputs.short_version }}"
caller_workflow = "${{ inputs.caller_workflow }}"
is_main = os.getenv("GITHUB_REF") == "refs/heads/main"
with open("release-notes.md", "w") as f:
f.write(release_notes.render(
timestamp=str(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")),
caller_workflow=caller_workflow,
branch="" if is_main else short_version,
branch_specific="" is_main else f"?branch={short_version}",
))
- name: Update nightly release description and binaries
if: always()
run: |
gh release edit ${{ inputs.release_tag }} --title "${{ steps.rename-installers.outputs.cura_version }}" --notes-file release-notes.md
for file in "installers/*"; do
gh release upload ${{ inputs.release_tag }} $file --clobber
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}