Skip to content

Merge pull request #20 from XRSec/dependabot/npm_and_yarn/electron-bu… #151

Merge pull request #20 from XRSec/dependabot/npm_and_yarn/electron-bu…

Merge pull request #20 from XRSec/dependabot/npm_and_yarn/electron-bu… #151

name: Build For Android Emulator
on:
push:
branches:
- main
workflow_dispatch:
jobs:
Build_For_Android_Emulator:
name: Build For Android Emulator
runs-on: macos-latest
steps:
-
name: Private Actions Checkout
uses: actions/checkout@v4
-
name: Build APP
run: |
brew install create-dmg
bash cli/deploy.sh
-
name: Get latest version
id: current-version
uses: cardinalby/git-get-release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
with:
latest: true
prerelease: false
-
name: Generate next version
uses: HardNorth/[email protected]
with:
version: ${{ steps.current-version.outputs.tag_name }}
next-version-increment-patch: true
-
name: Delete old Releases
uses: dev-drprasad/[email protected]
with:
repo: ${{ github.repository }}
keep_latest: 3
keep_min_download_counts: 1 # Optional parameters
delete_expired_data: 10 # Optional parameters
delete_tag_pattern: ""
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
-
name: Make release
uses: softprops/action-gh-release@v1
with:
files: "cli/dist/*.dmg"
body_path: cli/README.md
name: "Pre-release v${{ env.NEXT_VERSION }}"
tag_name: "${{ env.NEXT_VERSION }}"
draft: false
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
-
name: Get Data
id: getDingData
run: |
set -ex
# 输出仓库名
REPOSITORY="${{GITHUB.REPOSITORY}}"
echo "REPOSITORY=${REPOSITORY#*/}" >> $GITHUB_OUTPUT
# 获取用户仓库信息
# RESPONSE="$(curl -kfsSLm 10 https://api.github.com/repos/${{ GITHUB.REPOSITORY }})"
# 建议填写自己的 TOKEN
RESPONSE="$(curl -kfsSLm 10 https://api.github.com/repos/${{ GITHUB.REPOSITORY }} -H "Authorization: token ${{ SECRETS.TOKEN_GITHUB }}")"
# 获取 用户仓库 设置的 描述,如果为空,可能是没有使用 TOKEN
DESCRIPTION="$(jq -r .description <(echo ${RESPONSE}))"
echo "DESCRIPTION=${DESCRIPTION}" >> $GITHUB_OUTPUT
# 获取 用户仓库 设置的 URL, 如果没有就输出 Github 地址
URL="$(jq -r .homepage <(echo ${RESPONSE}))"
if [[ "${URL}" == "null" || "${URL}" == "" ]]; then
echo "URL=${{ GITHUB.SERVER_URL }}/${{ GITHUB.REPOSITORY }}" >> $GITHUB_OUTPUT
else
echo "URL=${URL}" >> $GITHUB_OUTPUT
fi
-
name: Send dingding notify
uses: zcong1993/actions-ding@master
with:
dingToken: ${{ SECRETS.DING_TOKEN }}
secret: ${{ SECRETS.DING_SECRET }}
body: |
{
"msgtype": "link",
"link": {
"text": "${{ steps.getDingData.outputs.DESCRIPTION }}",
"title": "${{ steps.getDingData.outputs.REPOSITORY }} WorkFlow ${{ GITHUB.JOB }} Success!",
"picUrl": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png",
"messageUrl": "${{ steps.getDingData.outputs.URL }}"
}
}