mirror of
https://github.com/MetaCubeX/ClashMetaForAndroid.git
synced 2024-11-25 14:56:09 +03:00
action: better release action
This commit is contained in:
parent
cbbcc2a6fe
commit
80037c2d23
85
.github/workflows/build-release.yaml
vendored
85
.github/workflows/build-release.yaml
vendored
@ -1,15 +1,11 @@
|
||||
name: Build Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*' #
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
auto-bump-version:
|
||||
description: 'Auto bump project version before building release'
|
||||
required: false
|
||||
type: boolean
|
||||
release-tag:
|
||||
description: 'Release Tag (v2.x.x)'
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
BuildRelease:
|
||||
@ -43,39 +39,40 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
|
||||
# If auto-bump-version is chosen BEGIN
|
||||
- name: Configure Git
|
||||
if: ${{ inputs.auto-bump-version }}
|
||||
- name: Convert and set version env
|
||||
id: process-version
|
||||
run: |
|
||||
VERSION_TAG=${{ inputs.release-tag }}
|
||||
VERSION_TAG=${VERSION_TAG#v} # remove the 'v' prefix
|
||||
IFS='.' read -ra VERSION_PARTS <<< "$VERSION_TAG" # split into array
|
||||
VERSION_CODE=$(printf "%1d%02d%03d" "${VERSION_PARTS[0]}" "${VERSION_PARTS[1]}" "${VERSION_PARTS[2]}")
|
||||
|
||||
echo "versonName=${{ inputs.release-tag }}" >> $GITHUB_OUTPUT
|
||||
echo "versonCode=$VERSION_CODE" >> $GITHUB_OUTPUT
|
||||
|
||||
# Re-write version in build.gradle.kts
|
||||
- name: Re-write version
|
||||
uses: Devofure/advance-android-version-actions@v1.4
|
||||
with:
|
||||
gradlePath: build.gradle.kts
|
||||
versionCode: ${{ steps.process-version.outputs.versonCode }}
|
||||
versionName: ${{ steps.process-version.outputs.versonName }}
|
||||
|
||||
# If any change found, commit it and push
|
||||
- name: Commit and push if changes
|
||||
run: |
|
||||
changes=$(git diff --name-only origin/main | wc -l)
|
||||
if [ $changes -gt 0 ]
|
||||
then
|
||||
newVersionName=${{ steps.process-version.outputs.versonName }}
|
||||
newVersionCode=${{ steps.process-version.outputs.versonCode }}
|
||||
git config --global user.name 'GitHub Action'
|
||||
git config --global user.email 'action@github.com'
|
||||
|
||||
- name: Auto bump project version
|
||||
if: ${{ inputs.auto-bump-version }}
|
||||
id: bump-version
|
||||
run: |
|
||||
versionCode=$(grep -oP 'versionCode = \K\d+' build.gradle.kts)
|
||||
versionName=$(grep -oP 'versionName = "\K[0-9.]+' build.gradle.kts)
|
||||
major=$(echo $versionName | cut -d. -f1)
|
||||
minor=$(echo $versionName | cut -d. -f2)
|
||||
patch=$(echo $versionName | cut -d. -f3)
|
||||
newPatch=$((patch + 1))
|
||||
newVersionName="$major.$minor.$newPatch"
|
||||
newVersionCode=$((versionCode + 1))
|
||||
sed -i "s/versionCode = $versionCode/versionCode = $newVersionCode/" build.gradle.kts
|
||||
sed -i "s/versionName = \"$versionName\"/versionName = \"$newVersionName\"/" build.gradle.kts
|
||||
echo "newVersionName=$newVersionName" >> $GITHUB_OUTPUT
|
||||
echo "newVersionCode=$newVersionCode" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Commit modified version code and make new tag
|
||||
if: ${{ inputs.auto-bump-version }}
|
||||
run: |
|
||||
newVersionName=${{ steps.bump-version.outputs.newVersionName }}
|
||||
newVersionCode=${{ steps.bump-version.outputs.newVersionCode }}
|
||||
git add build.gradle.kts
|
||||
git commit -am "Bump version to $newVersionName ($newVersionCode)"
|
||||
git tag "v$newVersionName"
|
||||
git push --follow-tags
|
||||
# If auto-bump-version is chosen END
|
||||
fi
|
||||
|
||||
- name: Signing properties
|
||||
env:
|
||||
@ -97,19 +94,10 @@ jobs:
|
||||
with:
|
||||
arguments: --no-daemon app:assembleMetaRelease
|
||||
|
||||
- name: Get real tag value (current or auto-bumped?)
|
||||
id: real_tag
|
||||
run: |
|
||||
if [[ "${{ inputs.auto-bump-version }}" == "true" ]]; then
|
||||
echo "tag=v${{ steps.bump-version.outputs.newVersionName }}" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Tag Repo
|
||||
uses: richardsimko/update-tag@v1
|
||||
with:
|
||||
tag_name: ${{ steps.real_tag.outputs.tag }}
|
||||
tag_name: ${{ steps.process-version.outputs.versonName }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@ -117,9 +105,16 @@ jobs:
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: ${{ success() }}
|
||||
with:
|
||||
tag_name: ${{ steps.real_tag.outputs.tag }}
|
||||
tag_name: ${{ steps.process-version.outputs.versonName }}
|
||||
files: app/build/outputs/apk/meta/release/*
|
||||
generate_release_notes: true
|
||||
|
||||
- name: Release Changelog Builder
|
||||
uses: mikepenz/release-changelog-builder-action@v3.6.0
|
||||
with:
|
||||
configurationJson: |
|
||||
{
|
||||
"ignore_labels": [
|
||||
"Update"
|
||||
],
|
||||
}
|
14
README.md
14
README.md
@ -60,18 +60,20 @@ APP package name is `com.github.metacubex.clash.meta`
|
||||
- Import a profile
|
||||
- URL Scheme `clash://install-config?url=<encoded URI>` or `clashmeta://install-config?url=<encoded URI>`
|
||||
|
||||
### Kernel Contribution
|
||||
### Contribution and Project Maintainance
|
||||
|
||||
#### Meta Kernel
|
||||
|
||||
- CMFA uses the kernel from `android-real` branch under `MetaCubeX/Clash.Meta`, which is a merge of the main `Alpha` branch and `android-open`.
|
||||
- If you want to contribute to the kernel, make PRs to `Alpha` branch of the Meta kernel repository.
|
||||
- If you want to contribute Android-specific patches to the kernel, make PRs to `android-open` branch of the Meta kernel repository.
|
||||
|
||||
### Project Maintainance
|
||||
#### Maintainance
|
||||
|
||||
- When `MetaCubeX/Clash.Meta` kernel is updated to a new version, the `Update Dependencies` actions in this repo will be triggered automatically.
|
||||
- It will pull the new version of the meta kernel, update all the golang dependencies, and create a PR without manual intervention.
|
||||
- If there is any compile error in PR, you need to fix it before merging. Alternatively, you may merge the PR directly.
|
||||
- Manually triggering `Build Pre-Release` actions will automatically compile and publish a `PreRelease` version.
|
||||
- Manually triggering `Build Release` actions will automatically compile, tag and publish a `Release` version.
|
||||
- There is an option `Auto bump project version` in trigger widget. If this option is checked and triggered, the `versionName` and `versionCode` in `build.gradle.kts` will be bumped first, then do the common build release process.
|
||||
- This option is intended for quickly update and release a new version online, without pulling the repository locally and work around by manual.
|
||||
- Manually triggering `Build Pre-Release` actions will compile and publish a `PreRelease` version.
|
||||
- Manually triggering `Build Release` actions will compile, tag and publish a `Release` version.
|
||||
- You must fill the blank `Release Tag` with the tag you want to release in the format of `v1.2.3`.
|
||||
- `versionName` and `versionCode` in `build.gradle.kts` will be automatically bumped to the tag you filled above.
|
||||
|
Loading…
Reference in New Issue
Block a user