Deploy #57
This file contains hidden or 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: Deploy | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| platforms: | |
| description: 'Platforms to build:' | |
| default: 'backend linux_arm32 linux_arm64 linux_x64 macos windows_x64 windows_portable' | |
| required: true | |
| release_type: | |
| description: 'Release type: alpha,beta,rc,stable, or any label with chars A-Za-z0-9._ for testing' | |
| default: 'test' | |
| required: true | |
| create_tag: | |
| description: 'Create tag & release: (if enabled, release type must be alpha,beta,rc,stable)' | |
| type: boolean | |
| default: false | |
| use_qt69: | |
| description: 'Use Qt 6.9' | |
| default: 'on' | |
| required: false | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| plan: | |
| name: 'Plan: ${{ inputs.release_type}} (tag=${{ inputs.create_tag }})' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| tag_name: ${{ steps.make_tag_info.outputs.TAG_NAME }} | |
| release_name: ${{ steps.make_tag_info.outputs.RELEASE_NAME }} | |
| steps: | |
| - name: Clone repo with history | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # entire history for all branches and tags | |
| - id: make_tag_info | |
| name: Make tag info | |
| env: | |
| RELEASE_TYPE: ${{ inputs.release_type }} | |
| CREATE_TAG: ${{ inputs.create_tag }} | |
| run: | | |
| git tag --list | tail -n 20 | |
| echo ========== | |
| buildscripts/ci/release/make_tag_name.sh | tee -a "${GITHUB_OUTPUT}" | |
| echo "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}" | |
| echo ========== | |
| # https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions | |
| if [[ "${CREATE_TAG}" == 'true' ]]; then | |
| echo "::notice ::Tag will be created" | |
| else | |
| echo "::warning ::Tag will NOT be created" | |
| fi | |
| build: | |
| name: Build | |
| needs: plan | |
| uses: ./.github/workflows/build_all.yml | |
| secrets: inherit | |
| with: | |
| platforms: ${{ inputs.platforms }} | |
| build_mode: ${{ inputs.release_type == 'stable' && 'stable' || 'testing' }} | |
| publish: ${{ inputs.create_tag && 'on' || 'off' }} | |
| deploy_backend: 'on' | |
| sentry_project: ${{ (inputs.create_tag && inputs.release_type == 'stable') && 'mu4' || 'sandbox' }} | |
| update_learn_playlists: | |
| name: 'Update Home→Learn playlists' | |
| if: ${{ github.repository == 'musescore/MuseScore' }} | |
| needs: build | |
| uses: ./.github/workflows/update_learn_playlists.yml | |
| secrets: inherit | |
| with: | |
| mode: ${{ inputs.create_tag && 'stable' || 'testing' }} | |
| environment: production # requires approval | |
| create_release: | |
| name: 'Create release: ${{ needs.plan.outputs.tag_name }}' | |
| needs: | |
| - plan # to access outputs | |
| - update_learn_playlists | |
| if: ${{ ! failure() && ! cancelled() && inputs.create_tag }} # run even if prior jobs were skipped | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: production # requires approval | |
| url: ${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ needs.plan.outputs.tag_name }} | |
| steps: | |
| - name: Clone repository | |
| uses: actions/checkout@v4 | |
| - name: Download and extract artifacts | |
| uses: actions/download-artifact@v5 | |
| with: | |
| path: build.artifacts | |
| - name: Collate release binaries | |
| run: | | |
| buildscripts/ci/release/collate_release_binaries.sh | |
| - name: Create tag # do this as late as possible so we're not left with a useless tag if something fails | |
| env: | |
| TAG_NAME: ${{ needs.plan.outputs.tag_name }} | |
| run: | | |
| int="(0|[1-9][0-9]*)" | |
| version="${int}\.${int}(\.${int})?" | |
| label="(alpha|beta|rc)(\.${int})?" | |
| pattern="^v${version}(-${label})?$" | |
| if [[ ! "${TAG_NAME}" =~ ${pattern} ]]; then | |
| echo >&2 "Error: TAG_NAME '${TAG_NAME}' doesn't match required regex: ${pattern}" | |
| exit 1 | |
| fi | |
| git tag "${TAG_NAME}" "${GITHUB_SHA}" | |
| git push origin "${TAG_NAME}" | |
| - name: Create draft release | |
| uses: softprops/action-gh-release@v2 | |
| with: # https://github.com/softprops/action-gh-release?tab=readme-ov-file#inputs | |
| draft: true | |
| prerelease: ${{ inputs.release_type != 'stable' }} | |
| files: release/* | |
| name: ${{ needs.plan.outputs.release_name }} | |
| tag_name: ${{ needs.plan.outputs.tag_name }} | |
| fail_on_unmatched_files: true | |
| generate_release_notes: false | |
| notify_users: | |
| name: Notify users | |
| needs: | |
| - plan # to access outputs | |
| - create_release | |
| if: ${{ github.repository == 'musescore/MuseScore' && ! failure() && ! cancelled() && needs.create_release.result == 'success' }} | |
| uses: ./.github/workflows/update_release_info.yml | |
| secrets: inherit | |
| with: | |
| mode: ${{ inputs.release_type == 'stable' && 'stable' || 'testing' }} | |
| tag: ${{ needs.plan.outputs.tag_name }} | |
| environment: production # requires approval |