mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-27 23:47:39 +01:00
CI: improve more ci worflow
This commit is contained in:
13
.github/workflows/alpha.yml
vendored
13
.github/workflows/alpha.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: macos-26
|
runs-on: macos-26
|
||||||
env:
|
env:
|
||||||
REF_NAME: alpha
|
REF_NAME: Alpha
|
||||||
CHANNEL: alpha
|
CHANNEL: alpha
|
||||||
UPSTREAM_CHANNEL: 'nightly'
|
UPSTREAM_CHANNEL: 'nightly'
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: 'SideStore/beta-build-num'
|
repository: 'SideStore/beta-build-num'
|
||||||
ref: ${{ env.REF_NAME }}
|
ref: ${{ env.CHANNEL }}
|
||||||
token: ${{ secrets.CROSS_REPO_PUSH_KEY }}
|
token: ${{ secrets.CROSS_REPO_PUSH_KEY }}
|
||||||
path: 'Dependencies/beta-build-num'
|
path: 'Dependencies/beta-build-num'
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
@@ -45,7 +45,7 @@ jobs:
|
|||||||
QUALIFIED_VERSION=$(python3 scripts/ci/workflow.py compute-qualified \
|
QUALIFIED_VERSION=$(python3 scripts/ci/workflow.py compute-qualified \
|
||||||
"$MARKETING_VERSION" \
|
"$MARKETING_VERSION" \
|
||||||
"$BUILD_NUM" \
|
"$BUILD_NUM" \
|
||||||
"${{ env.REF_NAME }}" \
|
"${{ env.CHANNEL }}" \
|
||||||
"$SHORT_COMMIT")
|
"$SHORT_COMMIT")
|
||||||
|
|
||||||
echo "BUILD_NUM=$BUILD_NUM" | tee -a $GITHUB_ENV
|
echo "BUILD_NUM=$BUILD_NUM" | tee -a $GITHUB_ENV
|
||||||
@@ -186,7 +186,7 @@ jobs:
|
|||||||
python3 scripts/ci/workflow.py deploy \
|
python3 scripts/ci/workflow.py deploy \
|
||||||
SideStore/apps-v2.json \
|
SideStore/apps-v2.json \
|
||||||
"$SOURCE_JSON" \
|
"$SOURCE_JSON" \
|
||||||
"$REF_NAME" \
|
"$CHANNEL" \
|
||||||
"$SHORT_COMMIT" \
|
"$SHORT_COMMIT" \
|
||||||
"$MARKETING_VERSION" \
|
"$MARKETING_VERSION" \
|
||||||
"$VERSION" \
|
"$VERSION" \
|
||||||
@@ -195,11 +195,12 @@ jobs:
|
|||||||
"$IPA_NAME" \
|
"$IPA_NAME" \
|
||||||
"$LAST_SUCCESSFUL_COMMIT"
|
"$LAST_SUCCESSFUL_COMMIT"
|
||||||
|
|
||||||
RELEASE_NOTES=$(python3 scripts/ci/workflow.py retrieve-release-notes "$REF_NAME")
|
RELEASE_NOTES=$(python3 scripts/ci/workflow.py retrieve-release-notes "$CHANNEL")
|
||||||
|
|
||||||
python3 scripts/ci/workflow.py upload-release \
|
python3 scripts/ci/workflow.py upload-release \
|
||||||
|
"$RELEASE_NAME" \
|
||||||
|
"$CHANNEL" \
|
||||||
"$VERSION" \
|
"$VERSION" \
|
||||||
"$REF_NAME" \
|
|
||||||
"$GITHUB_SHA" \
|
"$GITHUB_SHA" \
|
||||||
"$GITHUB_REPOSITORY" \
|
"$GITHUB_REPOSITORY" \
|
||||||
"$UPSTREAM_CHANNEL"
|
"$UPSTREAM_CHANNEL"
|
||||||
13
.github/workflows/nightly.yml
vendored
13
.github/workflows/nightly.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: macos-26
|
runs-on: macos-26
|
||||||
env:
|
env:
|
||||||
REF_NAME: nightly
|
RELEASE_NAME: Nightly
|
||||||
CHANNEL: nightly
|
CHANNEL: nightly
|
||||||
UPSTREAM_CHANNEL: ''
|
UPSTREAM_CHANNEL: ''
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: 'SideStore/beta-build-num'
|
repository: 'SideStore/beta-build-num'
|
||||||
ref: ${{ env.REF_NAME }}
|
ref: ${{ env.CHANNEL }}
|
||||||
token: ${{ secrets.CROSS_REPO_PUSH_KEY }}
|
token: ${{ secrets.CROSS_REPO_PUSH_KEY }}
|
||||||
path: 'Dependencies/beta-build-num'
|
path: 'Dependencies/beta-build-num'
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
@@ -47,7 +47,7 @@ jobs:
|
|||||||
QUALIFIED_VERSION=$(python3 scripts/ci/workflow.py compute-qualified \
|
QUALIFIED_VERSION=$(python3 scripts/ci/workflow.py compute-qualified \
|
||||||
"$MARKETING_VERSION" \
|
"$MARKETING_VERSION" \
|
||||||
"$BUILD_NUM" \
|
"$BUILD_NUM" \
|
||||||
"${{ env.REF_NAME }}" \
|
"${{ env.CHANNEL }}" \
|
||||||
"$SHORT_COMMIT")
|
"$SHORT_COMMIT")
|
||||||
|
|
||||||
echo "BUILD_NUM=$BUILD_NUM" | tee -a $GITHUB_ENV
|
echo "BUILD_NUM=$BUILD_NUM" | tee -a $GITHUB_ENV
|
||||||
@@ -188,7 +188,7 @@ jobs:
|
|||||||
python3 scripts/ci/workflow.py deploy \
|
python3 scripts/ci/workflow.py deploy \
|
||||||
SideStore/apps-v2.json \
|
SideStore/apps-v2.json \
|
||||||
"$SOURCE_JSON" \
|
"$SOURCE_JSON" \
|
||||||
"$REF_NAME" \
|
"$CHANNEL" \
|
||||||
"$SHORT_COMMIT" \
|
"$SHORT_COMMIT" \
|
||||||
"$MARKETING_VERSION" \
|
"$MARKETING_VERSION" \
|
||||||
"$VERSION" \
|
"$VERSION" \
|
||||||
@@ -197,11 +197,12 @@ jobs:
|
|||||||
"$IPA_NAME" \
|
"$IPA_NAME" \
|
||||||
"$LAST_SUCCESSFUL_COMMIT"
|
"$LAST_SUCCESSFUL_COMMIT"
|
||||||
|
|
||||||
RELEASE_NOTES=$(python3 scripts/ci/workflow.py retrieve-release-notes "$REF_NAME")
|
RELEASE_NOTES=$(python3 scripts/ci/workflow.py retrieve-release-notes "$CHANNEL")
|
||||||
|
|
||||||
python3 scripts/ci/workflow.py upload-release \
|
python3 scripts/ci/workflow.py upload-release \
|
||||||
|
"$RELEASE_NAME" \
|
||||||
|
"$CHANNEL" \
|
||||||
"$VERSION" \
|
"$VERSION" \
|
||||||
"$REF_NAME" \
|
|
||||||
"$GITHUB_SHA" \
|
"$GITHUB_SHA" \
|
||||||
"$GITHUB_REPOSITORY" \
|
"$GITHUB_REPOSITORY" \
|
||||||
"$UPSTREAM_CHANNEL"
|
"$UPSTREAM_CHANNEL"
|
||||||
@@ -6,7 +6,7 @@ import datetime
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
import textwrap
|
import inspect
|
||||||
|
|
||||||
|
|
||||||
# REPO ROOT relative to script dir
|
# REPO ROOT relative to script dir
|
||||||
@@ -365,14 +365,11 @@ def last_successful_commit(workflow, branch):
|
|||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def upload_release(release_name, release_tag, commit_sha, repo, upstream_recommendation):
|
def upload_release(release_name, release_tag, version, commit_sha, repo, upstream_recommendation):
|
||||||
token = getenv("GH_TOKEN")
|
token = getenv("GH_TOKEN")
|
||||||
if token:
|
if token:
|
||||||
os.environ["GH_TOKEN"] = token
|
os.environ["GH_TOKEN"] = token
|
||||||
|
|
||||||
# --------------------------------------------------
|
|
||||||
# load source metadata
|
|
||||||
# --------------------------------------------------
|
|
||||||
metadata_path = ROOT / "source-metadata.json"
|
metadata_path = ROOT / "source-metadata.json"
|
||||||
|
|
||||||
if not metadata_path.exists():
|
if not metadata_path.exists():
|
||||||
@@ -381,44 +378,40 @@ def upload_release(release_name, release_tag, commit_sha, repo, upstream_recomme
|
|||||||
meta = json.loads(metadata_path.read_text())
|
meta = json.loads(metadata_path.read_text())
|
||||||
|
|
||||||
is_beta = bool(meta.get("is_beta"))
|
is_beta = bool(meta.get("is_beta"))
|
||||||
version = meta.get("version_ipa")
|
build_datetime = meta.get("version_date")
|
||||||
built_date_alt = meta.get("version_date")
|
|
||||||
|
|
||||||
dt = datetime.datetime.fromisoformat(
|
dt = datetime.datetime.fromisoformat(
|
||||||
built_date_alt.replace("Z", "+00:00")
|
build_datetime.replace("Z", "+00:00")
|
||||||
)
|
)
|
||||||
built_date = dt.strftime("%c")
|
built_time = dt.strftime("%a %b %d %H:%M:%S %Y")
|
||||||
|
built_date = dt.strftime("%Y-%m-%d")
|
||||||
|
|
||||||
# --------------------------------------------------
|
|
||||||
# retrieve release notes inline
|
|
||||||
# --------------------------------------------------
|
|
||||||
release_notes = runAndGet(
|
release_notes = runAndGet(
|
||||||
f"python3 {SCRIPTS}/generate_release_notes.py "
|
f"python3 {SCRIPTS}/generate_release_notes.py "
|
||||||
f"--retrieve {release_tag} "
|
f"--retrieve {release_tag} "
|
||||||
f"--output-dir {ROOT}"
|
f"--output-dir {ROOT}"
|
||||||
)
|
)
|
||||||
|
|
||||||
# --------------------------------------------------
|
|
||||||
# optional upstream block
|
|
||||||
# --------------------------------------------------
|
|
||||||
upstream_block = ""
|
upstream_block = ""
|
||||||
if upstream_recommendation and upstream_recommendation.strip():
|
if upstream_recommendation and upstream_recommendation.strip():
|
||||||
upstream_block = upstream_recommendation.strip() + "\n\n"
|
upstream_block = upstream_recommendation.strip() + "\n\n"
|
||||||
|
|
||||||
body = textwrap.dedent(f"""\
|
raw_body = f"""
|
||||||
This is an ⚠️ **EXPERIMENTAL** ⚠️ {release_name} build for commit [{commit_sha}](https://github.com/{repo}/commit/{commit_sha}).
|
This is an ⚠️ **EXPERIMENTAL** ⚠️ {release_name} build for commit [{commit_sha}](https://github.com/{repo}/commit/{commit_sha}).
|
||||||
|
|
||||||
{release_name} builds are **extremely experimental builds only meant to be used by developers and beta testers. They often contain bugs and experimental features. Use at your own risk!**
|
{release_name} builds are **extremely experimental builds only meant to be used by developers and beta testers. They often contain bugs and experimental features. Use at your own risk!**
|
||||||
|
|
||||||
{upstream_block}## Build Info
|
{upstream_block}## Build Info
|
||||||
|
|
||||||
Built at (UTC): `{built_date}`
|
Built at (UTC): `{built_time}`
|
||||||
Built at (UTC date): `{built_date_alt}`
|
Built at (UTC date): `{built_date}`
|
||||||
Commit SHA: `{commit_sha}`
|
Commit SHA: `{commit_sha}`
|
||||||
Version: `{version}`
|
Version: `{version}`
|
||||||
|
|
||||||
{release_notes}
|
{release_notes}
|
||||||
""")
|
"""
|
||||||
|
|
||||||
|
body = inspect.cleandoc(raw_body) + "\n"
|
||||||
|
|
||||||
body_file = ROOT / "release_body.md"
|
body_file = ROOT / "release_body.md"
|
||||||
body_file.write_text(body, encoding="utf-8")
|
body_file.write_text(body, encoding="utf-8")
|
||||||
@@ -493,7 +486,7 @@ COMMANDS = {
|
|||||||
"retrieve-release-notes" : (retrieve_release_notes, 1, "<tag>"),
|
"retrieve-release-notes" : (retrieve_release_notes, 1, "<tag>"),
|
||||||
"deploy" : (deploy, 10,
|
"deploy" : (deploy, 10,
|
||||||
"<repo> <source_json> <release_tag> <short_commit> <marketing_version> <version> <channel> <bundle_id> <ipa_name> [last_successful_commit]"),
|
"<repo> <source_json> <release_tag> <short_commit> <marketing_version> <version> <channel> <bundle_id> <ipa_name> [last_successful_commit]"),
|
||||||
"upload-release" : (upload_release, 5, "<release_name> <release_tag> <commit_sha> <repo> <upstream_recommendation>"),
|
"upload-release" : (upload_release, 6, "<release_name> <release_tag> <version> <commit_sha> <repo> <upstream_recommendation>"),
|
||||||
}
|
}
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
Reference in New Issue
Block a user