|
| 1 | +# SPDX-FileCopyrightText: 2024 Howetuft |
| 2 | +# |
| 3 | +# |
| 4 | +# SPDX-License-Identifier: Apache-2.0 |
| 5 | + |
| 6 | +name: BlendLuxCore Create Release |
| 7 | + |
| 8 | +on: |
| 9 | + workflow_dispatch: |
| 10 | + inputs: |
| 11 | + release-version: |
| 12 | + description: "Release version (major.minor.patch[-pre])" |
| 13 | + required: True |
| 14 | + default: '' |
| 15 | + type: string |
| 16 | + allow-updates: |
| 17 | + description: "Update existing release (if any)" |
| 18 | + required: True |
| 19 | + type: boolean |
| 20 | + default: True |
| 21 | + rebuild-all: |
| 22 | + description: "Rebuild all" |
| 23 | + required: True |
| 24 | + type: boolean |
| 25 | + default: False |
| 26 | + |
| 27 | +jobs: |
| 28 | + check-version: |
| 29 | + name: 'Check version compliance' |
| 30 | + runs-on: ubuntu-latest |
| 31 | + steps: |
| 32 | + - name: Check version compliance |
| 33 | + if: ${{ inputs.release-version != '' }} |
| 34 | + shell: python |
| 35 | + run: | |
| 36 | + import sys |
| 37 | + import re |
| 38 | + version = "${{ inputs.release-version }}" |
| 39 | + semver_regex = r"^(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$" |
| 40 | + res = re.fullmatch(semver_regex, version) |
| 41 | + if res: |
| 42 | + print("::notice::Version number OK ('{version}')") |
| 43 | + else: |
| 44 | + message = [ |
| 45 | + f"::error::INVALID RELEASE VERSION NUMBER '{version}'", |
| 46 | + "Version must comply to Semantic Versioning standard:", |
| 47 | + "\n\tmajor.minor.patch[-pre]\n", |
| 48 | + "See https://semver.org for more information", |
| 49 | + "or leave the field blank for default value\n" |
| 50 | + ] |
| 51 | + print("\n".join(message)) |
| 52 | + sys.exit(1) |
| 53 | +
|
| 54 | + call-build-bundle: |
| 55 | + name: 'Build BlendLuxCore Bundle' |
| 56 | + needs: [check-version] |
| 57 | + uses: ./.github/workflows/build_bundle.yml |
| 58 | + with: |
| 59 | + build_type: Release |
| 60 | + |
| 61 | + create-release: |
| 62 | + name: 'Create release' |
| 63 | + if: github.event_name == 'workflow_dispatch' |
| 64 | + runs-on: ubuntu-latest |
| 65 | + needs: [call-build-bundle] |
| 66 | + permissions: |
| 67 | + id-token: write |
| 68 | + attestations: write |
| 69 | + contents: write |
| 70 | + steps: |
| 71 | + - run: | |
| 72 | + _version=${{ inputs.release-version }} |
| 73 | + echo "Creating release '${_version}'" |
| 74 | + echo "RELEASE_TAG=v${_version}" >> "$GITHUB_ENV" |
| 75 | + - uses: actions/checkout@v6 |
| 76 | + - run: mkdir ${{ github.workspace }}/dist |
| 77 | + - uses: actions/download-artifact@v7 |
| 78 | + with: |
| 79 | + path: ${{ github.workspace }}/dist |
| 80 | + merge-multiple: false |
| 81 | + |
| 82 | + - name: Display structure of downloaded files |
| 83 | + run: ls -Rl ${{ github.workspace }}/dist |
| 84 | + |
| 85 | + #- name: Re-zip artifacts |
| 86 | + #working-directory: ${{ github.workspace }}/dist |
| 87 | + #run: | |
| 88 | + #mkdir ../artifacts |
| 89 | + #for d in */ ; do |
| 90 | + #d2=${d%/} |
| 91 | + #echo "zip ${d2}" |
| 92 | + #zip -j ../artifacts/${d2}.zip ${d2}/* |
| 93 | + #done |
| 94 | + |
| 95 | + - id: make-release |
| 96 | + # Use full length commit SHA, otherwise CodeQL complains... |
| 97 | + uses: ncipollo/release-action@cdcc88a9acf3ca41c16c37bb7d21b9ad48560d87 |
| 98 | + with: |
| 99 | + name: "BlendLuxCore ${{ env.RELEASE_TAG }}" |
| 100 | + tag: ${{ env.RELEASE_TAG }} |
| 101 | + artifacts: ${{ github.workspace }}/dist/* |
| 102 | + removeArtifacts: true |
| 103 | + allowUpdates: ${{ inputs.allow-updates }} |
| 104 | + draft: true |
| 105 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 106 | + updateOnlyUnreleased: true |
| 107 | + body: | |
| 108 | + ## BlendLuxCore |
| 109 | +
|
| 110 | + This release was built from the following point in LuxCoreRender/BlendLuxCore: |
| 111 | + - Branch: ${{ needs.call-build-bundle.outputs.branch }} |
| 112 | + - Commit: ${{ needs.call-build-bundle.outputs.commit }} |
| 113 | +
|
| 114 | + Attestations: |
| 115 | + ${{ needs.call-build-bundle.outputs.attestation-url }} |
| 116 | +
|
| 117 | + - run: | |
| 118 | + echo "### Release""" >> $GITHUB_STEP_SUMMARY |
| 119 | + echo ${{ steps.make-release.outputs.html_url }} >> $GITHUB_STEP_SUMMARY |
0 commit comments