Fix syntax of thrown errors. #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |