mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-13 19:56:00 +08:00
Refactor GitHub actions workflow and improve environment handling
Changed the Github actions workflow by renaming "default-values" to "default_values" across multiple files. In addition, improved environment summary handling by reading its content if the file exists, and finally, appending certain variables to it. This makes the workflow more consistent and better handles the environment summary.
This commit is contained in:
parent
8f35c606d1
commit
2a81d57236
53
.github/workflows/installers.yml
vendored
53
.github/workflows/installers.yml
vendored
@ -43,7 +43,7 @@ env:
|
||||
LATEST_RELEASE_SCHEDULE_HOUR: 4
|
||||
|
||||
jobs:
|
||||
default-values:
|
||||
default_values:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
cura_conan_version: ${{ steps.default.outputs.cura_conan_version }}
|
||||
@ -76,11 +76,22 @@ jobs:
|
||||
f.writelines(f"cura_conan_version={cura_conan_version}\n")
|
||||
f.writelines(f"release_tag={release_tag}\n")
|
||||
|
||||
summary_env = os.environ["GITHUB_STEP_SUMMARY"]
|
||||
content = ""
|
||||
if os.path.exists(summary_env):
|
||||
with open(summary_env, "r") as f:
|
||||
content = f.read()
|
||||
|
||||
with open(summary_env, "w") as f:
|
||||
f.write(content)
|
||||
f.writelines(f"# cura_conan_version = {cura_conan_version}\n")
|
||||
f.writelines(f"# release_tag = {release_tag}\n")
|
||||
|
||||
windows-installer:
|
||||
uses: ./.github/workflows/windows.yml
|
||||
needs: [ default-values ]
|
||||
needs: [ default_values ]
|
||||
with:
|
||||
cura_conan_version: ${{ needs.default-values.outputs.cura_conan_version }}
|
||||
cura_conan_version: ${{ needs.default_values.outputs.cura_conan_version }}
|
||||
conan_args: ${{ github.event.inputs.conan_args }}
|
||||
enterprise: ${{ github.event.inputs.enterprise == 'true' }}
|
||||
staging: ${{ github.event.inputs.staging == 'true' }}
|
||||
@ -90,9 +101,9 @@ jobs:
|
||||
|
||||
linux-installer:
|
||||
uses: ./.github/workflows/linux.yml
|
||||
needs: [ default-values ]
|
||||
needs: [ default_values ]
|
||||
with:
|
||||
cura_conan_version: ${{ needs.default-values.outputs.cura_conan_version }}
|
||||
cura_conan_version: ${{ needs.default_values.outputs.cura_conan_version }}
|
||||
conan_args: ${{ github.event.inputs.conan_args }}
|
||||
enterprise: ${{ github.event.inputs.enterprise == 'true' }}
|
||||
staging: ${{ github.event.inputs.staging == 'true' }}
|
||||
@ -102,9 +113,9 @@ jobs:
|
||||
|
||||
macos-installer:
|
||||
uses: ./.github/workflows/macos.yml
|
||||
needs: [ default-values ]
|
||||
needs: [ default_values ]
|
||||
with:
|
||||
cura_conan_version: ${{ needs.default-values.outputs.cura_conan_version }}
|
||||
cura_conan_version: ${{ needs.default_values.outputs.cura_conan_version }}
|
||||
conan_args: ${{ github.event.inputs.conan_args }}
|
||||
enterprise: ${{ github.event.inputs.enterprise == 'true' }}
|
||||
staging: ${{ github.event.inputs.staging == 'true' }}
|
||||
@ -114,9 +125,9 @@ jobs:
|
||||
|
||||
macos-arm-installer:
|
||||
uses: ./.github/workflows/macos.yml
|
||||
needs: [ default-values ]
|
||||
needs: [ default_values ]
|
||||
with:
|
||||
cura_conan_version: ${{ needs.default-values.outputs.cura_conan_version }}
|
||||
cura_conan_version: ${{ needs.default_values.outputs.cura_conan_version }}
|
||||
conan_args: ${{ github.event.inputs.conan_args }}
|
||||
enterprise: ${{ github.event.inputs.enterprise == 'true' }}
|
||||
staging: ${{ github.event.inputs.staging == 'true' }}
|
||||
@ -128,7 +139,7 @@ jobs:
|
||||
update-nightly-release:
|
||||
if: ${{ inputs.nightly || github.event_name == 'schedule' }}
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ windows-installer, linux-installer, macos-installer, macos-arm-installer ]
|
||||
needs: [ default_values, windows-installer, linux-installer, macos-installer, macos-arm-installer ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
@ -196,8 +207,8 @@ jobs:
|
||||
|
||||
- name: Update nightly release for Linux
|
||||
run: |
|
||||
gh release upload ${{ needs.default-values.outputs.release_tag }} installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-linux-X64.AppImage --clobber
|
||||
gh release upload ${{ needs.default-values.outputs.release_tag }} installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-linux-X64.AppImage.asc --clobber
|
||||
gh release upload ${{ needs.default_values.outputs.release_tag }} installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-linux-X64.AppImage --clobber
|
||||
gh release upload ${{ needs.default_values.outputs.release_tag }} installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-linux-X64.AppImage.asc --clobber
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@ -220,8 +231,8 @@ jobs:
|
||||
|
||||
- name: Update nightly release for Windows
|
||||
run: |
|
||||
gh release upload ${{ needs.default-values.outputs.release_tag }} installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-win64-X64.msi --clobber
|
||||
gh release upload ${{ needs.default-values.outputs.release_tag }} installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-win64-X64.exe --clobber
|
||||
gh release upload ${{ needs.default_values.outputs.release_tag }} installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-win64-X64.msi --clobber
|
||||
gh release upload ${{ needs.default_values.outputs.release_tag }} installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-win64-X64.exe --clobber
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@ -244,8 +255,8 @@ jobs:
|
||||
|
||||
- name: Update nightly release for MacOS (X64)
|
||||
run: |
|
||||
gh release upload ${{ needs.default-values.outputs.release_tag }} installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-macos-X64.dmg --clobber
|
||||
gh release upload ${{ needs.default-values.outputs.release_tag }} installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-macos-X64.pkg --clobber
|
||||
gh release upload ${{ needs.default_values.outputs.release_tag }} installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-macos-X64.dmg --clobber
|
||||
gh release upload ${{ needs.default_values.outputs.release_tag }} installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-macos-X64.pkg --clobber
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@ -268,8 +279,8 @@ jobs:
|
||||
|
||||
- name: Update nightly release for MacOS (ARM-64)
|
||||
run: |
|
||||
gh release upload ${{ needs.default-values.outputs.release_tag }} installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-macos-ARM64.dmg --clobber
|
||||
gh release upload ${{ needs.default-values.outputs.release_tag }} installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-macos-ARM64.pkg --clobber
|
||||
gh release upload ${{ needs.default_values.outputs.release_tag }} installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-macos-ARM64.dmg --clobber
|
||||
gh release upload ${{ needs.default_values.outputs.release_tag }} installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-macos-ARM64.pkg --clobber
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@ -282,17 +293,17 @@ jobs:
|
||||
with open(".github/workflows/release-notes.md.jinja", "r") as f:
|
||||
release_notes = Template(f.read())
|
||||
|
||||
current_nightly_beta = "${{ needs.default-values.outputs.release_tag }}".split("nightly-")[-1]
|
||||
current_nightly_beta = "${{ needs.default_values.outputs.release_tag }}".split("nightly-")[-1]
|
||||
with open("release-notes.md", "w") as f:
|
||||
f.write(release_notes.render(
|
||||
timestamp=${{ steps.filename.outputs.NIGHTLY_TIME }},
|
||||
branch="" if ${{ needs.default-values.outputs.release_tag == 'nightly' }} else current_nightly_beta,
|
||||
branch="" if ${{ needs.default_values.outputs.release_tag == 'nightly' }} else current_nightly_beta,
|
||||
branch_specific="" if os.getenv("GITHUB_REF") == "refs/heads/main" else f"?branch={current_nightly_beta}",
|
||||
))
|
||||
|
||||
- name: Update nightly release description (with date)
|
||||
if: always()
|
||||
run: |
|
||||
gh release edit ${{ needs.default-values.outputs.release_tag }} --title "${{ steps.filename.outputs.NIGHTLY_NAME }}" --notes-file release-notes.md
|
||||
gh release edit ${{ needs.default_values.outputs.release_tag }} --title "${{ steps.filename.outputs.NIGHTLY_NAME }}" --notes-file release-notes.md
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user