-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor!: core and cli installer (#118)
**Features:** - Introduce the `core-installer` feature to disable core installation. **Refactors:** - Transform `find_lib/resource` into methods of `Dirs`. - Add a global `DIRS` variable to avoid pass it everywhere. - Move constants to a separate module. **BREAKING CHANGES:** - Replace the `self` feature with `cli_installer`. - Make `maa update` reject updating `MaaCore` installed at non-standard locations. - Change Version JSON files to adopt multiple channels, resembling the version JSON of `MaaCore`. - Remove deprecated field `channel` in `cli.toml`. - Remove all installer-related environment variables. Users can now specify them either in the configuration file or as command-line arguments.
- Loading branch information
Showing
22 changed files
with
2,111 additions
and
903 deletions.
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,56 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
CARGO_PKG_VERSION=$(yq -r '.package.version' maa-cli/Cargo.toml) | ||
COMMIT_SHA=$(git rev-parse HEAD) | ||
|
||
if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then | ||
echo "PR detected, marking version as alpha pre-release and skipping publish" | ||
channel="alpha" | ||
publish="false" | ||
VERSION="$CARGO_PKG_VERSION-alpha.$(date +%s)" | ||
elif [ "$GITHUB_EVENT_NAME" == "schedule" ]; then | ||
echo "Scheduled event detected, marking version as alpha pre-release and publish to alpha channel" | ||
# check if there are some new commits | ||
channel="alpha" | ||
pubulished_commit=$(yq -r ".details.commit" version/$channel.json) | ||
last_commit="$COMMIT_SHA" | ||
if [ "$pubulished_commit" == "$last_commit" ]; then | ||
echo "No new commits, exiting, skipping all steps" | ||
echo "skip=true" >> "$GITHUB_OUTPUT" | ||
exit 0 | ||
fi | ||
VERSION="$CARGO_PKG_VERSION-alpha.$(date +%s)" | ||
publish="true" | ||
elif [ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]; then | ||
echo "Workflow dispatch event detected, reading inputs" | ||
beta=$(yq -r '.inputs.beta' "$GITHUB_EVENT_PATH") | ||
if [ "$beta" == "true" ]; then | ||
echo "Beta flag detected, marking version as beta pre-release and publish to beta channel" | ||
beta_number=$(yq -r ".details.beta_number" version/beta.json) | ||
VERSION="$CARGO_PKG_VERSION-beta.$beta_number" | ||
channel="beta" | ||
else | ||
echo "No beta flag detected, marking version as stable release and publish to stable channel" | ||
channel="stable" | ||
fi | ||
publish=$(yq -r '.inputs.publish' "$GITHUB_EVENT_PATH") | ||
else | ||
REF_VERSION=${GITHUB_REF#refs/tags/v} | ||
if [ "$REF_VERSION" == "$GITHUB_REF" ]; then | ||
echo "Version tag not matched, aborting" | ||
exit 1 | ||
fi | ||
echo "Tag detected, marking version as stable release and publish to stable channel" | ||
channel="stable" | ||
VERSION="$REF_VERSION" | ||
fi | ||
echo "Release version $VERSION to $channel channel and publish=$publish" | ||
{ | ||
echo "channel=$channel" | ||
echo "commit=$COMMIT_SHA" | ||
echo "version=$VERSION" | ||
echo "publish=$publish" | ||
echo "skip=false" | ||
} >> "$GITHUB_OUTPUT" |
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
Oops, something went wrong.