CI cleanup / don't unexpectedly publish nightly builds when manually run with "publish: off" #1058
Workflow file for this run
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: 'Build: Windows' | |
on: | |
pull_request: | |
schedule: | |
- cron: '0 3 */1 */1 *' # At 03:00 on every day-of-month for master | |
- cron: '0 5 */1 */1 *' # At 05:00 on every day-of-month for current release branch | |
workflow_dispatch: | |
inputs: | |
platforms: | |
description: 'Platforms to build:' | |
default: 'windows_x64 windows_portable' | |
required: true | |
build_mode: | |
description: 'Build mode: devel, nightly, testing, stable' | |
default: 'devel' | |
required: true | |
publish: | |
description: 'Publish to FTP: on - publish' | |
default: 'off' | |
required: false | |
sentry_project: | |
description: 'Upload symbols and dumps to Sentry (choose a project): mu4(default for stable build), sandbox' | |
default: '' | |
required: false | |
workflow_call: | |
inputs: | |
platforms: | |
description: 'Platforms to build:' | |
default: 'windows_x64 windows_portable' | |
type: string | |
required: true | |
build_mode: | |
description: 'Build mode: devel, nightly, testing, stable' | |
default: 'devel' | |
type: string | |
required: true | |
publish: | |
description: 'Publish to FTP: on - publish' | |
default: 'off' | |
type: string | |
required: false | |
sentry_project: | |
description: 'Upload symbols and dumps to Sentry (choose a project): mu4(default for stable build), sandbox' | |
default: '' | |
type: string | |
required: false | |
env: | |
CURRENT_RELEASE_BRANCH: 4.4.3 | |
jobs: | |
windows_x64: | |
if: | | |
(github.event_name != 'workflow_dispatch' || contains(inputs.platforms, 'windows_x64')) && | |
(github.event_name != 'schedule' || github.repository == 'musescore/MuseScore') | |
runs-on: windows-2022 | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- name: Exit if current release branch configuration is incorrect | |
if: ${{ github.event_name == 'schedule' && github.event.schedule == '0 5 */1 */1 *' && env.CURRENT_RELEASE_BRANCH == '' }} | |
run: | | |
echo "::error::CURRENT_RELEASE_BRANCH is empty" | |
exit 1 | |
- name: Clone repository (default) | |
uses: actions/checkout@v4 | |
if: ${{ github.event_name != 'schedule' || github.event.schedule == '0 3 */1 */1 *' }} | |
- name: Clone repository (${{ env.CURRENT_RELEASE_BRANCH }}) | |
uses: actions/checkout@v4 | |
if: ${{ github.event_name == 'schedule' && github.event.schedule == '0 5 */1 */1 *' }} | |
with: | |
ref: ${{ env.CURRENT_RELEASE_BRANCH }} | |
- name: "Configure workflow" | |
shell: bash | |
env: | |
pull_request_title: ${{ github.event.pull_request.title }} | |
SENTRY_SERVER_MU4_KEY: ${{ secrets.SENTRY_SERVER_MU4_KEY }} | |
SENTRY_SERVER_SANDBOX_KEY: ${{ secrets.SENTRY_SERVER_SANDBOX_KEY }} | |
SENTRY_PROJECT: ${{ inputs.sentry_project }} | |
run: | | |
bash ./buildscripts/ci/tools/make_build_mode_env.sh -e ${{ github.event_name }} -m ${{ inputs.build_mode }} | |
BUILD_MODE=$(cat ./build.artifacts/env/build_mode.env) | |
bash ./buildscripts/ci/tools/make_build_number.sh | |
BUILD_NUMBER=$(cat ./build.artifacts/env/build_number.env) | |
DO_UPDATE_TS='false' | |
if [[ "$BUILD_MODE" == "testing" || "$BUILD_MODE" == "stable" ]]; then | |
DO_UPDATE_TS='true' | |
if [ -z "${{ secrets.TRANSIFEX_API_TOKEN }}" ]; then | |
echo "::warning::TRANSIFEX_API_TOKEN is empty; updating .ts files disabled" | |
DO_UPDATE_TS='false' | |
fi | |
fi | |
DO_PLACEHOLDER_TRANSLATIONS='false' | |
if [[ "$BUILD_MODE" == "nightly" || "$BUILD_MODE" == "devel" ]]; then | |
DO_PLACEHOLDER_TRANSLATIONS='true' | |
fi | |
DO_UPLOAD_SYMBOLS='false' | |
SENTRY_URL="" | |
if [ "$SENTRY_SERVER_MU4_KEY" != "" ]; then | |
if [ -z "$SENTRY_PROJECT" ] && [ "$BUILD_MODE" == "stable" ]; then | |
SENTRY_PROJECT="mu4" | |
fi | |
if [ "$SENTRY_PROJECT" == "mu4" ]; then | |
DO_UPLOAD_SYMBOLS='true' | |
SENTRY_URL=https://sentry.musescore.org/api/4/minidump/?sentry_key=$SENTRY_SERVER_MU4_KEY | |
fi | |
fi | |
if [ -z "$SENTRY_PROJECT" ] && [ "$BUILD_MODE" == "nightly" ]; then | |
SENTRY_PROJECT="sandbox" | |
fi | |
if [ "$SENTRY_PROJECT" == "sandbox" ] && [ "$SENTRY_SERVER_SANDBOX_KEY" != "" ]; then | |
DO_UPLOAD_SYMBOLS='true' | |
SENTRY_URL=https://sentry.musescore.org/api/3/minidump/?sentry_key=$SENTRY_SERVER_SANDBOX_KEY | |
fi | |
DO_PUBLISH='false' | |
if [[ "${{ inputs.publish }}" == "on" || ("${{ github.event_name }}" == "schedule" && $BUILD_MODE == 'nightly') ]]; then | |
DO_PUBLISH='true' | |
if [ -z "${{ secrets.OSUOSL_SSH_ENCRYPT_SECRET }}" ]; then | |
echo "::warning::OSUOSL_SSH_ENCRYPT_SECRET is empty; not publishing to OSUOSL" | |
DO_PUBLISH='false' | |
fi | |
fi | |
ADD_INFO="_${GITHUB_REF#refs/heads/}" | |
if [ "${{ github.event_name }}" == "schedule" ] && [ "${{ github.event.schedule }}" == "0 5 */1 */1 *" ]; then ADD_INFO="_${CURRENT_RELEASE_BRANCH}"; fi | |
if [ "${{ github.event_name }}" == "pull_request" ]; then ADD_INFO="_${{ github.event.pull_request.number }}_${pull_request_title}"; fi | |
UPLOAD_ARTIFACT_NAME="$(tr '":<>|*?/\\’' '_' <<<"MU4_${BUILD_NUMBER}_Win${ADD_INFO}")" | |
echo "github.repository: ${{ github.repository }}" | |
echo "BUILD_MODE=$BUILD_MODE" | tee -a $GITHUB_ENV | |
echo "BUILD_NUMBER=$BUILD_NUMBER" | tee -a $GITHUB_ENV | |
echo "DO_UPDATE_TS=$DO_UPDATE_TS" | tee -a $GITHUB_ENV | |
echo "DO_PLACEHOLDER_TRANSLATIONS=$DO_PLACEHOLDER_TRANSLATIONS" | tee -a $GITHUB_ENV | |
echo "DO_UPLOAD_SYMBOLS=$DO_UPLOAD_SYMBOLS" | tee -a $GITHUB_ENV | |
echo "SENTRY_PROJECT=$SENTRY_PROJECT" | tee -a $GITHUB_ENV | |
echo "SENTRY_URL=$SENTRY_URL" | tee -a $GITHUB_ENV | |
echo "DO_PUBLISH=$DO_PUBLISH" | tee -a $GITHUB_ENV | |
echo "UPLOAD_ARTIFACT_NAME=$UPLOAD_ARTIFACT_NAME" | tee -a $GITHUB_ENV | |
- name: Setup environment | |
run: | | |
buildscripts\ci\windows\setup.bat | |
- name: Make environment file | |
shell: bash | |
run: | | |
bash ./buildscripts/ci/windows/make_environment.sh | |
- name: Generate _en.ts files | |
shell: bash | |
env: | |
LUPDATE_ARGS: "" | |
POSTPROCESS_ARGS: "--warn-only ${{ env.DO_PLACEHOLDER_TRANSLATIONS == 'true' && '--generate-placeholder-translations' || '' }}" | |
POSTPROCESS_LAUNCHER: "python3 -X utf8" | |
run: | | |
bash ./buildscripts/ci/translation/run_lupdate.sh | |
- name: Update .ts files | |
if: env.DO_UPDATE_TS == 'true' | |
shell: bash | |
run: | | |
bash ./buildscripts/ci/translation/tx_install.sh -t ${{ secrets.TRANSIFEX_API_TOKEN }} -s windows | |
bash ./buildscripts/ci/translation/tx_pull.sh | |
- name: Build | |
shell: cmd | |
run: | | |
IF ${{ env.SENTRY_URL != 0 }} == true ( SET C_URL="${{ env.SENTRY_URL }}" ) ELSE ( SET C_URL="" ) | |
buildscripts\ci\windows\build.bat -n ${{ env.BUILD_NUMBER }} --crash_log_url %C_URL% | |
- name: Package | |
shell: cmd | |
run: | | |
IF ${{ secrets.WIN_SIGN_CERTIFICATE_ENCRYPT_SECRET != 0 }} == true ( SET S_S=${{ secrets.WIN_SIGN_CERTIFICATE_ENCRYPT_SECRET }} ) ELSE ( SET S_S="''" ) | |
IF ${{ secrets.WIN_SIGN_CERTIFICATE_PASSWORD != 0 }} == true ( SET S_P=${{ secrets.WIN_SIGN_CERTIFICATE_PASSWORD }} ) ELSE ( SET S_P="''" ) | |
IF ${{ env.BUILD_MODE }} == stable ( SET GUID=${{ secrets.WIN_MSI_STABLE_MU4_GUID }} ) ELSE ( SET GUID=${{ secrets.WIN_MSI_TESTING_MU4_GUID }} ) | |
buildscripts\ci\windows\package.bat --signsecret %S_S% --signpass %S_P% --guid %GUID% | |
- name: Checksum | |
run: | | |
bash ./buildscripts/ci/tools/checksum.sh | |
- name: Generate and upload dump symbols | |
if: env.DO_UPLOAD_SYMBOLS == 'true' | |
shell: bash | |
run: | | |
APP_BIN=$(pwd)/build.release/src/app/MuseScore4.pdb | |
cmake -DAPP_BIN=${APP_BIN} \ | |
-DSENTRY_URL=https://sentry.musescore.org \ | |
-DSENTRY_ORG=musescore \ | |
-DSENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} \ | |
-DSENTRY_PROJECT=${SENTRY_PROJECT} \ | |
-P buildscripts/ci/crashdumps/ci_generate_and_upload.cmake | |
- name: Publish to OSUOSL | |
if: env.DO_PUBLISH == 'true' | |
shell: bash | |
run: | | |
bash ./buildscripts/ci/tools/osuosl/publish.sh -s ${{ secrets.OSUOSL_SSH_ENCRYPT_SECRET }} --os windows -v 4 | |
- name: Upload artifacts on GitHub | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.UPLOAD_ARTIFACT_NAME }} | |
path: build.artifacts\ | |
windows_portable: | |
# Disable on pull_request | |
if: | | |
github.event_name != 'pull_request' && | |
(github.event_name != 'workflow_dispatch' || contains(inputs.platforms, 'windows_portable')) && | |
(github.event_name != 'schedule' || github.repository == 'musescore/MuseScore') | |
runs-on: windows-2022 | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- name: Clone repository (default) | |
uses: actions/checkout@v4 | |
if: ${{ github.event_name != 'schedule' || github.event.schedule == '0 3 */1 */1 *' }} | |
- name: Clone repository (${{ env.CURRENT_RELEASE_BRANCH }}) | |
uses: actions/checkout@v4 | |
if: ${{ github.event_name == 'schedule' && github.event.schedule == '0 5 */1 */1 *' }} | |
with: | |
ref: ${{ env.CURRENT_RELEASE_BRANCH }} | |
- name: "Configure workflow" | |
shell: bash | |
env: | |
pull_request_title: ${{ github.event.pull_request.title }} | |
run: | | |
bash ./buildscripts/ci/tools/make_build_mode_env.sh -e ${{ github.event_name }} -m ${{ inputs.build_mode }} | |
BUILD_MODE=$(cat ./build.artifacts/env/build_mode.env) | |
bash ./buildscripts/ci/tools/make_build_number.sh | |
BUILD_NUMBER=$(cat ./build.artifacts/env/build_number.env) | |
DO_UPDATE_TS='false' | |
if [[ "$BUILD_MODE" == "testing" || "$BUILD_MODE" == "stable" ]]; then | |
DO_UPDATE_TS='true' | |
if [ -z "${{ secrets.TRANSIFEX_API_TOKEN }}" ]; then | |
echo "::warning::TRANSIFEX_API_TOKEN is empty; updating .ts files disabled" | |
DO_UPDATE_TS='false' | |
fi | |
fi | |
DO_PLACEHOLDER_TRANSLATIONS='false' | |
if [[ "$BUILD_MODE" == "nightly" || "$BUILD_MODE" == "devel" ]]; then | |
DO_PLACEHOLDER_TRANSLATIONS='true' | |
fi | |
DO_PUBLISH='false' | |
if [[ "${{ inputs.publish }}" == "on" || ("${{ github.event_name }}" == "schedule" && $BUILD_MODE == 'nightly') ]]; then | |
DO_PUBLISH='true' | |
if [ -z "${{ secrets.OSUOSL_SSH_ENCRYPT_SECRET }}" ]; then | |
echo "::warning::OSUOSL_SSH_ENCRYPT_SECRET is empty; not publishing to OSUOSL" | |
DO_PUBLISH='false' | |
fi | |
fi | |
ADD_INFO="_${GITHUB_REF#refs/heads/}" | |
if [ "${{ github.event_name }}" == "schedule" ] && [ "${{ github.event.schedule }}" == "0 5 */1 */1 *" ]; then ADD_INFO="_${CURRENT_RELEASE_BRANCH}"; fi | |
if [ "${{ github.event_name }}" == "pull_request" ]; then ADD_INFO="_${{ github.event.pull_request.number }}_${pull_request_title}"; fi | |
UPLOAD_ARTIFACT_NAME="$(tr '":<>|*?/\\’' '_' <<<"MU4_${BUILD_NUMBER}_Win_portable${ADD_INFO}")" | |
echo "github.repository: ${{ github.repository }}" | |
echo "BUILD_MODE=$BUILD_MODE" | tee -a $GITHUB_ENV | |
echo "BUILD_NUMBER=$BUILD_NUMBER" | tee -a $GITHUB_ENV | |
echo "DO_UPDATE_TS=$DO_UPDATE_TS" | tee -a $GITHUB_ENV | |
echo "DO_PLACEHOLDER_TRANSLATIONS=$DO_PLACEHOLDER_TRANSLATIONS" | tee -a $GITHUB_ENV | |
echo "DO_PUBLISH=$DO_PUBLISH" | tee -a $GITHUB_ENV | |
echo "UPLOAD_ARTIFACT_NAME=$UPLOAD_ARTIFACT_NAME" | tee -a $GITHUB_ENV | |
- name: Setup environment | |
run: | | |
buildscripts\ci\windows\setup.bat --portable ON | |
- name: Make environment file | |
shell: bash | |
run: | | |
bash ./buildscripts/ci/windows/make_environment.sh | |
- name: Generate _en.ts files | |
shell: bash | |
env: | |
LUPDATE_ARGS: "" | |
POSTPROCESS_ARGS: "--warn-only ${{ env.DO_PLACEHOLDER_TRANSLATIONS == 'true' && '--generate-placeholder-translations' || '' }}" | |
POSTPROCESS_LAUNCHER: "python3 -X utf8" | |
run: | | |
bash ./buildscripts/ci/translation/run_lupdate.sh | |
- name: Update .ts files | |
if: env.DO_UPDATE_TS == 'true' | |
shell: bash | |
run: | | |
bash ./buildscripts/ci/translation/tx_install.sh -t ${{ secrets.TRANSIFEX_API_TOKEN }} -s windows | |
bash ./buildscripts/ci/translation/tx_pull.sh | |
- name: Build | |
shell: cmd | |
run: | | |
IF ${{ env.SENTRY_URL != 0 }} == true ( SET C_URL="${{ env.SENTRY_URL }}" ) ELSE ( SET C_URL="" ) | |
buildscripts\ci\windows\build.bat --portable ON -n ${{ env.BUILD_NUMBER }} --crash_log_url %C_URL% | |
- name: Package | |
shell: cmd | |
run: | | |
IF ${{ secrets.WIN_SIGN_CERTIFICATE_ENCRYPT_SECRET != 0 }} == true ( SET S_S=${{ secrets.WIN_SIGN_CERTIFICATE_ENCRYPT_SECRET }} ) ELSE ( SET S_S="''" ) | |
IF ${{ secrets.WIN_SIGN_CERTIFICATE_PASSWORD != 0 }} == true ( SET S_P=${{ secrets.WIN_SIGN_CERTIFICATE_PASSWORD }} ) ELSE ( SET S_P="''" ) | |
buildscripts\ci\windows\package.bat --portable ON --signsecret %S_S% --signpass %S_P% | |
- name: Checksum | |
run: | | |
bash ./buildscripts/ci/tools/checksum.sh | |
- name: Publish to OSUOSL | |
if: env.DO_PUBLISH == 'true' | |
shell: bash | |
run: | | |
bash ./buildscripts/ci/tools/osuosl/publish.sh -s ${{ secrets.OSUOSL_SSH_ENCRYPT_SECRET }} --os windows -v 4 --arch x86_64-portable | |
- name: Upload artifacts on GitHub | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.UPLOAD_ARTIFACT_NAME }} | |
path: build.artifacts\ |