forked from musescore/MuseScore
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
33 changed files
with
511 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
name: 'Update: Release Info' | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
mode: | ||
description: 'Mode: stable, testing (alpha, beta, rc)' | ||
default: 'testing' | ||
required: true | ||
tag: | ||
description: 'Release tag (latest stable by default)' | ||
required: false | ||
workflow_call: | ||
inputs: | ||
mode: | ||
description: 'Mode: stable, testing (alpha, beta, rc)' | ||
default: 'testing' | ||
type: string | ||
required: true | ||
tag: | ||
description: 'Release tag (latest stable by default)' | ||
type: string | ||
required: false | ||
environment: | ||
description: "Environment: use 'production' to prompt for approval" | ||
default: '' | ||
type: string | ||
required: false | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
update-release-info: | ||
runs-on: ubuntu-20.04 | ||
environment: | ||
name: ${{ inputs.environment }} # can be empty/blank (if so, URL will not be shown) | ||
url: ${{ github.server_url }}/${{ github.repository }}/releases/${{ inputs.tag && format('tag/{0}', inputs.tag) || 'latest' }} # show on run page | ||
steps: | ||
- name: Clone repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Update info about the release in musescore-updates | ||
if: ${{ false }} | ||
run: | | ||
S3_URL="s3://musescore-updates/feed/latest.xml" | ||
S3_ALL_URL="s3://musescore-updates/feed/all.xml" | ||
if [ ${{ inputs.mode }} == "testing" ]; then | ||
S3_URL="s3://musescore-updates/feed/latest.test.xml" | ||
S3_ALL_URL="s3://musescore-updates/feed/all.test.xml" | ||
fi | ||
sudo bash ./build/ci/release/make_release_info_file.sh \ | ||
--token ${{ secrets.GITHUB_TOKEN }} \ | ||
--repo ${{ github.repository }} \ | ||
--release_tag ${{ inputs.tag }} | ||
sudo bash ./build/ci/release/push_file_to_s3.sh \ | ||
--s3_key ${{ secrets.S3_KEY_UPDATE }} \ | ||
--s3_secret ${{ secrets.S3_SECRET_UPDATE }} \ | ||
--s3_url ${S3_URL} \ | ||
--s3_bucket ${{ secrets.S3_BUCKET_UPDATE }} \ | ||
--file_name "release_info.json" | ||
sudo bash ./build/ci/release/make_previous_releases_notes.sh \ | ||
--s3_key ${{ secrets.S3_KEY_UPDATE }} \ | ||
--s3_secret ${{ secrets.S3_SECRET_UPDATE }} \ | ||
--s3_url ${S3_ALL_URL} \ | ||
--s3_bucket ${{ secrets.S3_BUCKET_UPDATE }} \ | ||
--current_file_name "release_info.json" \ | ||
--previous_file_name "previous_releases_notes.json" | ||
sudo bash ./build/ci/release/push_file_to_s3.sh \ | ||
--s3_key ${{ secrets.S3_KEY_UPDATE }} \ | ||
--s3_secret ${{ secrets.S3_SECRET_UPDATE }} \ | ||
--s3_url ${S3_ALL_URL} \ | ||
--s3_bucket ${{ secrets.S3_BUCKET_UPDATE }} \ | ||
--file_name "previous_releases_notes.json" |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/usr/bin/env python3 | ||
# SPDX-License-Identifier: GPL-3.0-only | ||
# MuseScore-Studio-CLA-applies | ||
# | ||
# MuseScore Studio | ||
# Music Composition & Notation | ||
# | ||
# Copyright (C) 2024 MuseScore Limited | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License version 3 as | ||
# published by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
import sys | ||
import json | ||
|
||
CURRENT_RELEASE_INFO_FILE = sys.argv[1] | ||
PREVIOUS_RELEASE_INFO_FILE = sys.argv[2] | ||
|
||
print("=== Load jsons ===") | ||
|
||
json_file = open(CURRENT_RELEASE_INFO_FILE, "r+") | ||
current_release_info_json = json.load(json_file) | ||
json_file.close() | ||
|
||
json_file = open(PREVIOUS_RELEASE_INFO_FILE, "r+") | ||
previous_release_info_json = json.load(json_file) | ||
json_file.close() | ||
|
||
print("=== Append current release notes to previous releases notes ===") | ||
|
||
tag_name = current_release_info_json["tag_name"] | ||
version = tag_name[1:] | ||
new_release = {"version": version, "notes": current_release_info_json["bodyMarkdown"]} | ||
|
||
if "releases" not in previous_release_info_json: | ||
previous_release_info_json["releases"] = [] | ||
|
||
is_release_already_in_previous_releases = False | ||
for release in previous_release_info_json["releases"]: | ||
if release["version"] in version: | ||
release["notes"] = new_release["notes"] | ||
is_release_already_in_previous_releases = True | ||
|
||
if not is_release_already_in_previous_releases: | ||
previous_release_info_json["releases"].append(new_release) | ||
|
||
previous_release_info_json_updated = json.dumps(previous_release_info_json) | ||
|
||
print("=== Write json ===") | ||
|
||
json_file = open(PREVIOUS_RELEASE_INFO_FILE, "w") | ||
json_file.write(previous_release_info_json_updated) | ||
json_file.close() |
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
#!/usr/bin/env python3 | ||
# SPDX-License-Identifier: GPL-3.0-only | ||
# MuseScore-Studio-CLA-applies | ||
# | ||
# MuseScore Studio | ||
# Music Composition & Notation | ||
# | ||
# Copyright (C) 2021 MuseScore Limited | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License version 3 as | ||
# published by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
import sys | ||
def eprint(*args, **kwargs): | ||
print(*args, **kwargs, file=sys.stderr) | ||
|
||
if __name__ == '__main__' and sys.prefix == sys.base_prefix: | ||
# Not running inside a virtual environment. Let's try to load one. | ||
import os | ||
old_dir = os.path.realpath(__file__) | ||
new_dir, script_name = os.path.split(old_dir) | ||
rel_pyi = r'.venv\Scripts\python.exe' if sys.platform == 'win32' else '.venv/bin/python' | ||
while new_dir != old_dir: | ||
abs_pyi = os.path.join(new_dir, rel_pyi) | ||
if os.access(abs_pyi, os.X_OK): | ||
eprint(f'{script_name}: Loading virtual environment:\n {abs_pyi}') | ||
if sys.platform == 'win32': | ||
import subprocess | ||
raise SystemExit(subprocess.run([abs_pyi, *sys.argv]).returncode) | ||
os.execl(abs_pyi, abs_pyi, *sys.argv) | ||
old_dir = new_dir | ||
new_dir = os.path.dirname(new_dir) | ||
eprint(f'{script_name}: Not running inside a virtual environment.') | ||
del old_dir, new_dir, rel_pyi, abs_pyi, script_name | ||
|
||
import sys | ||
import json | ||
import markdown | ||
|
||
RELEASE_INFO_FILE = sys.argv[1] | ||
|
||
eprint("=== Load json ===") | ||
|
||
json_file = open(RELEASE_INFO_FILE, "r+") | ||
release_info_json = json.load(json_file) | ||
json_file.close() | ||
|
||
eprint("=== Make html version of body ===") | ||
|
||
release_body_markdown = release_info_json["body"] | ||
|
||
release_body_html = markdown.markdown(release_body_markdown) | ||
|
||
# Correct result of Markdown parser | ||
# Escape single quotes | ||
release_body_html = release_body_html.replace("'", "`") | ||
|
||
# Correct new lines next to <ul> and </ul> | ||
release_body_html = release_body_html.replace("\n<ul>\n", "<ul>") | ||
release_body_html = release_body_html.replace("\n</ul>\n", "</ul>") | ||
|
||
release_info_json["body"] = "'" + release_body_html + "'" | ||
release_info_json["bodyMarkdown"] = release_body_markdown | ||
|
||
eprint("=== Split release assets ===") | ||
|
||
# For backward compatibility, we must adhere to the rule: | ||
# for each platform, there should be one file with the corresponding extension. | ||
# Let's place the new files into a new field with separate handling in MuseScore. | ||
|
||
release_assets = release_info_json["assets"] | ||
release_new_assets = [] | ||
|
||
i = 0 | ||
while i < len(release_assets): | ||
asset = release_assets[i] | ||
name = asset.get("name") | ||
if ".AppImage" in name and ("aarch64" in name or "armv7l" in name): | ||
release_new_assets.append(asset) | ||
del release_assets[i] | ||
else: | ||
i += 1 | ||
|
||
release_info_json["assets"] = release_assets | ||
release_info_json["assetsNew"] = release_new_assets | ||
|
||
release_info_json_updated = json.dumps(release_info_json) | ||
|
||
eprint("=== Write json ===") | ||
|
||
json_file = open(RELEASE_INFO_FILE, "w") | ||
json_file.write(release_info_json_updated) | ||
json_file.close() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/usr/bin/env bash | ||
# SPDX-License-Identifier: GPL-3.0-only | ||
# MuseScore-Studio-CLA-applies | ||
# | ||
# MuseScore Studio | ||
# Music Composition & Notation | ||
# | ||
# Copyright (C) 2024 MuseScore Limited | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License version 3 as | ||
# published by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
ARTIFACTS_DIR=build.artifacts | ||
|
||
S3_KEY="" | ||
S3_SECRET="" | ||
S3_URL="" | ||
S3_BUCKET="" | ||
|
||
LOCAL_FILE_NAME="" | ||
|
||
while [[ "$#" -gt 0 ]]; do | ||
case $1 in | ||
--s3_key) S3_KEY="$2"; shift ;; | ||
--s3_secret) S3_SECRET="$2"; shift ;; | ||
--s3_url) S3_URL="$2"; shift ;; | ||
--s3_bucket) S3_BUCKET="$2"; shift ;; | ||
--local_file_name) LOCAL_FILE_NAME="$2"; shift ;; | ||
*) echo "Unknown parameter passed: $1"; exit 1 ;; | ||
esac | ||
shift | ||
done | ||
|
||
command -v s3cmd >/dev/null 2>&1 | ||
if [[ $? -ne 0 ]]; then | ||
echo "=== Install tools ===" | ||
|
||
apt install python3-setuptools | ||
|
||
echo "Install s3cmd" | ||
pip3 install s3cmd | ||
fi | ||
|
||
cat >~/.s3cfg <<EOL | ||
[default] | ||
access_key = ${S3_KEY} | ||
secret_key = ${S3_SECRET} | ||
host_base = ${S3_BUCKET} | ||
host_bucket = ${S3_BUCKET} | ||
website_endpoint = https://${S3_BUCKET} | ||
EOL | ||
|
||
echo "=== Get file from S3 ===" | ||
|
||
s3cmd get "$S3_URL" "$ARTIFACTS_DIR/$LOCAL_FILE_NAME" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
# SPDX-License-Identifier: GPL-3.0-only | ||
# MuseScore-Studio-CLA-applies | ||
# | ||
# MuseScore Studio | ||
# Music Composition & Notation | ||
# | ||
# Copyright (C) 2021 MuseScore Limited | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License version 3 as | ||
# published by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
ARTIFACTS_DIR=build.artifacts | ||
|
||
mkdir -p $ARTIFACTS_DIR | ||
echo "" > $ARTIFACTS_DIR/release_info.json | ||
cat $ARTIFACTS_DIR/release_info.json |
Oops, something went wrong.