mirror of
https://github.com/MetaCubeX/ClashMetaForAndroid.git
synced 2024-11-29 00:36:09 +03:00
action: better release action
This commit is contained in:
parent
cbbcc2a6fe
commit
80037c2d23
89
.github/workflows/build-release.yaml
vendored
89
.github/workflows/build-release.yaml
vendored
@ -1,15 +1,11 @@
|
|||||||
name: Build Release
|
name: Build Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- '*' #
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
auto-bump-version:
|
release-tag:
|
||||||
description: 'Auto bump project version before building release'
|
description: 'Release Tag (v2.x.x)'
|
||||||
required: false
|
required: true
|
||||||
type: boolean
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
BuildRelease:
|
BuildRelease:
|
||||||
@ -43,39 +39,40 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-go-
|
${{ runner.os }}-go-
|
||||||
|
|
||||||
# If auto-bump-version is chosen BEGIN
|
- name: Convert and set version env
|
||||||
- name: Configure Git
|
id: process-version
|
||||||
if: ${{ inputs.auto-bump-version }}
|
|
||||||
run: |
|
run: |
|
||||||
git config --global user.name 'GitHub Action'
|
VERSION_TAG=${{ inputs.release-tag }}
|
||||||
git config --global user.email 'action@github.com'
|
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
|
||||||
|
|
||||||
- name: Auto bump project version
|
# Re-write version in build.gradle.kts
|
||||||
if: ${{ inputs.auto-bump-version }}
|
- name: Re-write version
|
||||||
id: bump-version
|
uses: Devofure/advance-android-version-actions@v1.4
|
||||||
run: |
|
with:
|
||||||
versionCode=$(grep -oP 'versionCode = \K\d+' build.gradle.kts)
|
gradlePath: build.gradle.kts
|
||||||
versionName=$(grep -oP 'versionName = "\K[0-9.]+' build.gradle.kts)
|
versionCode: ${{ steps.process-version.outputs.versonCode }}
|
||||||
major=$(echo $versionName | cut -d. -f1)
|
versionName: ${{ steps.process-version.outputs.versonName }}
|
||||||
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 any change found, commit it and push
|
||||||
if: ${{ inputs.auto-bump-version }}
|
- name: Commit and push if changes
|
||||||
run: |
|
run: |
|
||||||
newVersionName=${{ steps.bump-version.outputs.newVersionName }}
|
changes=$(git diff --name-only origin/main | wc -l)
|
||||||
newVersionCode=${{ steps.bump-version.outputs.newVersionCode }}
|
if [ $changes -gt 0 ]
|
||||||
git commit -am "Bump version to $newVersionName ($newVersionCode)"
|
then
|
||||||
git tag "v$newVersionName"
|
newVersionName=${{ steps.process-version.outputs.versonName }}
|
||||||
git push --follow-tags
|
newVersionCode=${{ steps.process-version.outputs.versonCode }}
|
||||||
# If auto-bump-version is chosen END
|
git config --global user.name 'GitHub Action'
|
||||||
|
git config --global user.email 'action@github.com'
|
||||||
|
git add build.gradle.kts
|
||||||
|
git commit -am "Bump version to $newVersionName ($newVersionCode)"
|
||||||
|
git tag "v$newVersionName"
|
||||||
|
git push --follow-tags
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Signing properties
|
- name: Signing properties
|
||||||
env:
|
env:
|
||||||
@ -96,20 +93,11 @@ jobs:
|
|||||||
uses: gradle/gradle-build-action@v2
|
uses: gradle/gradle-build-action@v2
|
||||||
with:
|
with:
|
||||||
arguments: --no-daemon app:assembleMetaRelease
|
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
|
- name: Tag Repo
|
||||||
uses: richardsimko/update-tag@v1
|
uses: richardsimko/update-tag@v1
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ steps.real_tag.outputs.tag }}
|
tag_name: ${{ steps.process-version.outputs.versonName }}
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
@ -117,9 +105,16 @@ jobs:
|
|||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
if: ${{ success() }}
|
if: ${{ success() }}
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ steps.real_tag.outputs.tag }}
|
tag_name: ${{ steps.process-version.outputs.versonName }}
|
||||||
files: app/build/outputs/apk/meta/release/*
|
files: app/build/outputs/apk/meta/release/*
|
||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
|
|
||||||
- name: Release Changelog Builder
|
- name: Release Changelog Builder
|
||||||
uses: mikepenz/release-changelog-builder-action@v3.6.0
|
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
|
- Import a profile
|
||||||
- URL Scheme `clash://install-config?url=<encoded URI>` or `clashmeta://install-config?url=<encoded URI>`
|
- 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`.
|
- 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 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.
|
- 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.
|
- 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.
|
- 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.
|
- 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 Pre-Release` actions will compile and publish a `PreRelease` version.
|
||||||
- Manually triggering `Build Release` actions will automatically compile, tag and publish a `Release` version.
|
- Manually triggering `Build Release` actions will 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.
|
- You must fill the blank `Release Tag` with the tag you want to release in the format of `v1.2.3`.
|
||||||
- This option is intended for quickly update and release a new version online, without pulling the repository locally and work around by manual.
|
- `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