mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 15:07:28 -06:00
Add scripts for process automation
This commit is contained in:
parent
f76deb71ab
commit
b71662f4dd
4 changed files with 289 additions and 0 deletions
64
.github/workflows/release-process_feature-freeze.yml
vendored
Normal file
64
.github/workflows/release-process_feature-freeze.yml
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
name: Feature Freeze
|
||||
run-name: Feature freeze Cura ${{ inputs.cura_version }} by @${{ github.actor }}
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
cura_version:
|
||||
description: 'Cura version major and minor, e.g. 5.7'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
parse-version:
|
||||
name: Parse input version string
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
package_version: ${{ steps.version_parser.outputs.major }}.${{ steps.version_parser.outputs.minor }}.0
|
||||
branch_name: ${{ steps.version_parser.outputs.major }}.${{ steps.version_parser.outputs.minor }}
|
||||
steps:
|
||||
- name: Parse version string
|
||||
id: version_parser
|
||||
uses: booxmedialtd/ws-action-parse-semver@v1.4.7
|
||||
with:
|
||||
input_string: ${{ inputs.cura_version }}
|
||||
|
||||
feature-freeze:
|
||||
name: Process feature freeze
|
||||
runs-on: ubuntu-latest
|
||||
needs: [parse-version]
|
||||
strategy:
|
||||
matrix:
|
||||
repository: [Cura, Uranium, CuraEngine, cura-binary-data, fdm_materials]
|
||||
include:
|
||||
- main_branch: main
|
||||
- repository: Cura
|
||||
main_branch: CURA-10769_automate_release_action
|
||||
- repository: fdm_materials
|
||||
main_branch: master
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: Ultimaker/${{ matrix.repository }}
|
||||
ref: ${{ matrix.main_branch }}
|
||||
token: ${{ secrets.CURA_AUTORELEASE_PAT }}
|
||||
|
||||
- name: Update conan package version
|
||||
run: |
|
||||
PACKAGE_VERSION=${{ needs.parse-version.outputs.package_version }}
|
||||
sed -i "s/version:.*/version: \"$PACKAGE_VERSION\"/g" conandata.yml
|
||||
|
||||
- name: Update resources conan package version
|
||||
if: ${{ matrix.repository == Cura }}
|
||||
run: |
|
||||
PACKAGE_VERSION=${{ needs.parse-version.outputs.package_version }}
|
||||
sed -i "s/version:.*/version: \"$PACKAGE_VERSION\"/g" resources/conandata.yml
|
||||
|
||||
- name: Create branch and commit
|
||||
uses: stefanzweifel/git-auto-commit-action@v5.0.1
|
||||
with:
|
||||
commit_message: Set conan package version ${{ needs.parse-version.outputs.package_version }}
|
||||
file_pattern: conandata.yml
|
||||
branch: ${{ needs.parse-version.outputs.branch_name }}
|
||||
create_branch: true
|
172
.github/workflows/release-process_release-candidate.yml
vendored
Normal file
172
.github/workflows/release-process_release-candidate.yml
vendored
Normal file
|
@ -0,0 +1,172 @@
|
|||
name: Prepare Release Candidate
|
||||
run-name: Release Candidate for Cura ${{ inputs.cura_version }} by @${{ github.actor }}
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
cura_version:
|
||||
description: 'Cura version number, e.g. 5.7, 5.7.2 or 5.8.0-beta.2'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
parse-version:
|
||||
name: Parse input version string
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
version_major: ${{ steps.version_parser.outputs.major }}
|
||||
version_minor: ${{ steps.version_parser.outputs.minor }}
|
||||
version_patch: ${{ steps.version_parser.outputs.patch }}
|
||||
branch_name: ${{ steps.version_parser.outputs.major }}.${{ steps.version_parser.outputs.minor }}
|
||||
steps:
|
||||
- name: Parse version string
|
||||
id: version_parser
|
||||
uses: booxmedialtd/ws-action-parse-semver@v1.4.7
|
||||
with:
|
||||
input_string: ${{ inputs.cura_version }}
|
||||
|
||||
prepare-cura-repo:
|
||||
name: Update dependencies and find RC tag name
|
||||
runs-on: ubuntu-latest
|
||||
needs: [parse-version]
|
||||
outputs:
|
||||
tag_name: ${{ steps.find-available-tag-name.outputs.tag_name }}
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ needs.parse-version.outputs.branch_name }}
|
||||
fetch-tags: true
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Update Cura dependencies
|
||||
run: |
|
||||
PACKAGE_VERSION=${{ inputs.cura_version }}
|
||||
sed -i "s/\"uranium\/.*/\"uranium\/$PACKAGE_VERSION\"/g" conandata.yml
|
||||
sed -i "s/\"cura_resources\/.*/\"cura_resources\/$PACKAGE_VERSION\"/g" conandata.yml
|
||||
sed -i "s/\"curaengine\/.*/\"curaengine\/$PACKAGE_VERSION\"/g" conandata.yml
|
||||
sed -i "s/\"cura_binary_data\/.*/\"cura_binary_data\/$PACKAGE_VERSION\"/g" conandata.yml
|
||||
sed -i "s/\"fdm_materials\/.*/\"fdm_materials\/$PACKAGE_VERSION\"/g" conandata.yml
|
||||
|
||||
- name: Commit new dependencies versioning
|
||||
uses: stefanzweifel/git-auto-commit-action@v5.0.1
|
||||
with:
|
||||
commit_message: Set dependencies version ${{ inputs.cura_version }}
|
||||
file_pattern: conandata.yml
|
||||
|
||||
- name: Find available tag name
|
||||
id: find-available-tag-name
|
||||
run: |
|
||||
VERSION=${{ inputs.cura_version }}
|
||||
|
||||
RC_INDEX=0
|
||||
while
|
||||
RC_INDEX=$((RC_INDEX+1))
|
||||
TAG_NAME="$VERSION-RC$RC_INDEX"
|
||||
[[ $(git tag -l "$TAG_NAME") ]]
|
||||
do true; done
|
||||
|
||||
echo "tag_name=$TAG_NAME" >> "$GITHUB_OUTPUT"
|
||||
|
||||
create-tags:
|
||||
name: Create tags
|
||||
runs-on: ubuntu-latest
|
||||
needs: [parse-version, prepare-cura-repo]
|
||||
strategy:
|
||||
matrix:
|
||||
repository: [Cura, Uranium, CuraEngine, cura-binary-data, fdm_materials]
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: Ultimaker/${{ matrix.repository }}
|
||||
ref: ${{ needs.parse-version.outputs.branch_name }}
|
||||
token: ${{ secrets.CURA_AUTORELEASE_PAT }}
|
||||
|
||||
- name: Create tag
|
||||
run: |
|
||||
git tag ${{ needs.prepare-cura-repo.outputs.tag_name }}
|
||||
git push origin tag ${{ needs.prepare-cura-repo.outputs.tag_name }}
|
||||
|
||||
create-dependencies-packages:
|
||||
name: Create conan packages for dependencies
|
||||
uses: ultimaker/cura-workflows/.github/workflows/conan-package-release.yml@CURA-10769_automate_release_action
|
||||
needs: [parse-version, prepare-cura-repo]
|
||||
strategy:
|
||||
matrix:
|
||||
repository: [Cura, Uranium, CuraEngine, cura-binary-data, fdm_materials]
|
||||
include:
|
||||
- conan_recipe_root: "."
|
||||
- repository: Cura
|
||||
conan_recipe_root: "resources"
|
||||
with:
|
||||
repository: ${{ matrix.repository }}
|
||||
ref_name: ${{ needs.parse-version.outputs.branch_name }}
|
||||
version: ${{ inputs.cura_version }}
|
||||
conan_release: true
|
||||
conan_user_channel: ultimaker/stable
|
||||
conan_internal: false
|
||||
conan_latest: true
|
||||
conan_recipe_root: ${{ matrix.conan_recipe_root }}
|
||||
secrets: inherit
|
||||
|
||||
create-cura-package:
|
||||
name: Create conan package for Cura
|
||||
uses: ultimaker/cura-workflows/.github/workflows/conan-package-release.yml@CURA-10769_automate_release_action
|
||||
needs: [parse-version, create-dependencies-packages]
|
||||
with:
|
||||
repository: Cura
|
||||
ref_name: ${{ needs.parse-version.outputs.branch_name }}
|
||||
version: ${{ inputs.cura_version }}
|
||||
conan_release: true
|
||||
conan_user_channel: ultimaker/stable
|
||||
conan_internal: false
|
||||
conan_latest: true
|
||||
secrets: inherit
|
||||
|
||||
create-installers:
|
||||
name: Create installers
|
||||
uses: ./.github/workflows/installers.yml@CURA-10769_automate_release_action
|
||||
needs: [parse-version, create-cura-package]
|
||||
with:
|
||||
cura_conan_version: cura/${{ inputs.cura_version }}@/
|
||||
enterprise: false
|
||||
staging: false
|
||||
nightly: false
|
||||
secrets: inherit
|
||||
|
||||
create-release-draft:
|
||||
name: Create the release draft
|
||||
runs-on: ubuntu-latest
|
||||
needs: [create-installers, parse-version]
|
||||
steps:
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v4.1.7
|
||||
with:
|
||||
path: artifacts
|
||||
merge-multiple: true
|
||||
|
||||
- name: Checkout Cura repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ needs.parse-version.outputs.branch_name }}
|
||||
|
||||
- name: Extract changelog
|
||||
run: python ./scripts/extract_changelog.py --version ${{ needs.parse-version.outputs.version_major }}.${{ needs.parse-version.outputs.version_minor }}.${{ needs.parse-version.outputs.version_patch }} --changelog ./resources/texts/change_log.txt > formatted_changelog.txt
|
||||
|
||||
- name: Get commit id for release
|
||||
id: get-commit-id
|
||||
uses: iawia002/get-tag-or-commit-id@v1.0.1
|
||||
with:
|
||||
length: 40
|
||||
|
||||
- name: Create release
|
||||
uses: notpeelz/action-gh-create-release@v5.0.1
|
||||
with:
|
||||
target: ${{ steps.get-commit-id.outputs.id }}
|
||||
tag: ${{ inputs.cura_version }}
|
||||
strategy: replace
|
||||
title: UltiMaker Cura ${{ inputs.cura_version }}
|
||||
draft: true
|
||||
body-source: file
|
||||
body: formatted_changelog.txt
|
19
.github/workflows/release-process_tester.yml
vendored
Normal file
19
.github/workflows/release-process_tester.yml
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
name: Test release actions
|
||||
run-name: Test
|
||||
|
||||
on:
|
||||
push
|
||||
|
||||
jobs:
|
||||
test-feature-freeze:
|
||||
uses: ultimaker/cura-workflows/.github/workflows/release-process_feature-freeze.yml@CURA-10769_automate_release_action
|
||||
with:
|
||||
cura_version: 255.124
|
||||
secrets: inherit
|
||||
|
||||
test-release-candidate:
|
||||
uses: ultimaker/cura-workflows/.github/workflows/release-process_release-candidate.yml@CURA-10769_automate_release_action
|
||||
needs: [test-feature-freeze]
|
||||
with:
|
||||
cura_version: 255.124.0-beta.1
|
||||
secrets: inherit
|
34
scripts/extract_changelog.py
Normal file
34
scripts/extract_changelog.py
Normal file
|
@ -0,0 +1,34 @@
|
|||
import argparse
|
||||
import re
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description = 'Extract the changelog to be inserted to the release description')
|
||||
parser.add_argument('--changelog', type = str, help = 'Path to the changelog file', required = True)
|
||||
parser.add_argument('--version', type = str, help = 'Cura version to be extracted', required = True)
|
||||
args = parser.parse_args()
|
||||
|
||||
start_token = f"[{args.version}]"
|
||||
pattern_stop_log = "\[\d+(\.\d+){1,2}\]"
|
||||
log_line = False
|
||||
first_chapter = True
|
||||
|
||||
with open(args.changelog, "r") as changelog_file:
|
||||
for line in changelog_file.readlines():
|
||||
line = line.strip()
|
||||
|
||||
if log_line:
|
||||
if re.match(pattern_stop_log, line):
|
||||
log_line = False
|
||||
elif len(line) > 0:
|
||||
if line.startswith('*'):
|
||||
if not first_chapter:
|
||||
print("")
|
||||
first_chapter = False
|
||||
|
||||
line = line[1:].strip()
|
||||
print(f"<H2>{line}</H2>\n")
|
||||
else:
|
||||
print(line)
|
||||
elif line == start_token:
|
||||
log_line = True
|
Loading…
Add table
Add a link
Reference in a new issue