Skip to content

release

release #7

Workflow file for this run

name: release
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- name: 1. 准备文件
run: |
echo "version=$(jq -r .version $GITHUB_WORKSPACE/module.json)" >> $GITHUB_ENV
echo "versionCode=$(jq -r .versionCode $GITHUB_WORKSPACE/module.json)" >> $GITHUB_ENV
echo "ModuleFolderName=module_files" >> $GITHUB_ENV
- name: 2. 制作模块
run: |
mkdir -p "$GITHUB_WORKSPACE"/GithubRelease
echo "version=${{ env.version }}" >>$GITHUB_WORKSPACE/${{ env.ModuleFolderName }}/module.prop
echo "versionCode=${{ env.versionCode }}" >>$GITHUB_WORKSPACE/${{ env.ModuleFolderName }}/module.prop
- name: 3. 更新下载链接
run: |
git config --global user.email "[email protected]"
git config --global user.name "Mzdyl"
sed -i '4d' $GITHUB_WORKSPACE/module.json
browser_download_url=$(curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ github.token }}" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/Mzdyl/OneUI_CSC_Features/releases/tags/${{ env.version }} | jq -r .assets[].browser_download_url | cut -d'"' -f2)
sed -i '3a "zipUrl": "'"$browser_download_url"'",' $GITHUB_WORKSPACE/module.json
jq . $GITHUB_WORKSPACE/module.json > $GITHUB_WORKSPACE/new.json
rm -rf $GITHUB_WORKSPACE/module.json && mv $GITHUB_WORKSPACE/new.json $GITHUB_WORKSPACE/module.json
git add ./module.json
if git commit -m "${{ env.version }}"; then
echo "push=true" >> $GITHUB_ENV
else
echo "push=false" >> $GITHUB_ENV
fi
- if: ${{ env.push == 'true' }}
name: 4. 推送到Magisk Module仓库
uses: ad-m/github-push-action@master
with:
branch: ${{ github.ref }}