80 lines
2.4 KiB
YAML
80 lines
2.4 KiB
YAML
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
||
on:
|
||
push:
|
||
branches:
|
||
- prod
|
||
jobs:
|
||
Explore-Gitea-Actions:
|
||
runs-on: ubuntu64
|
||
steps:
|
||
- name: 拉取代码
|
||
uses: http://git.missmoc.top/mocheng/checkout@v4
|
||
with:
|
||
fetch-depth: 0
|
||
|
||
# - name: Setup Node.js
|
||
# uses: actions/setup-node@v3
|
||
# with:
|
||
# node-version: 16
|
||
# cache: 'npm'
|
||
|
||
- name: Install dependencies
|
||
run: |
|
||
npm install
|
||
# 安装HBuilderX命令行工具
|
||
npm install -g hbuilderx-cli
|
||
|
||
# - name: Build H5 project
|
||
# run: |
|
||
# # 执行HBuild项目构建
|
||
# npm run build
|
||
|
||
- name: Cloud package (Android)
|
||
run: |
|
||
# 使用HBuilderX CLI进行云打包
|
||
hbuilderx package \
|
||
--project . \
|
||
--platform android \
|
||
--appid ${{ secrets.HBUILDER_APPID }} \
|
||
--username ${{ secrets.HBUILDERX_USERNAME }} \
|
||
--password ${{ secrets.HBUILDERX_PASSWORD }} \
|
||
--output ./dist
|
||
env:
|
||
HBUILDER_CLOUD_PACKAGE: true
|
||
|
||
- name: Prepare release assets
|
||
run: |
|
||
# 重命名APK文件以便于识别版本
|
||
mv ./dist/*.apk ./dist/app-release-${{ github.sha }}.apk
|
||
# 对于iOS,根据实际打包输出调整
|
||
if [ -f ./dist/*.ipa ]; then
|
||
mv ./dist/*.ipa ./dist/app-release-${{ github.sha }}.ipa
|
||
fi
|
||
|
||
- name: Create Gitea Release
|
||
if: startsWith(github.ref, 'refs/tags/')
|
||
uses: actions/create-release@v1
|
||
with:
|
||
tag_name: ${{ github.ref_name }}
|
||
release_name: Release ${{ github.ref_name }}
|
||
body: |
|
||
自动构建版本 ${{ github.ref_name }}
|
||
提交哈希: ${{ github.sha }}
|
||
draft: false
|
||
prerelease: false
|
||
env:
|
||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||
|
||
- name: Upload Android Asset
|
||
if: startsWith(github.ref, 'refs/tags/')
|
||
uses: actions/upload-release-asset@v1
|
||
with:
|
||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||
asset_path: ./dist/app-release-${{ github.sha }}.apk
|
||
asset_name: app-android-${{ github.ref_name }}.apk
|
||
asset_content_type: application/vnd.android.package-archive
|
||
env:
|
||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||
|
||
|