unity publish #52
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: unity publish | |
on: | |
workflow_dispatch: | |
inputs: | |
tag_name: | |
description: 'tag name' | |
required: true | |
env: | |
RUNID: 613573412 | |
jobs: | |
android: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: BuildAndroid | |
uses: ./.github/workflows/composites/unity-build-plugins/android/ | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
backend: v8_9.4 | |
- name: reset | |
shell: bash | |
run: | | |
cd $GITHUB_WORKSPACE | |
rm -rf unity/Assets/core/upm/Plugins | |
- name: BuildAndroidQuickJS | |
uses: ./.github/workflows/composites/unity-build-plugins/android/ | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
backend: quickjs | |
- name: reset | |
shell: bash | |
run: | | |
cd $GITHUB_WORKSPACE | |
rm -rf unity/Assets/core/upm/Plugins | |
- name: BuildAndroidNodeJS | |
uses: ./.github/workflows/composites/unity-build-plugins/android/ | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
backend: nodejs_16 | |
ios: | |
runs-on: macos-11 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: BuildiOS | |
uses: ./.github/workflows/composites/unity-build-plugins/ios/ | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
backend: v8_9.4 | |
- name: reset | |
shell: bash | |
run: | | |
cd $GITHUB_WORKSPACE | |
rm -rf unity/Assets/core/upm/Plugins | |
- name: BuildiOSQuickjs | |
uses: ./.github/workflows/composites/unity-build-plugins/ios/ | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
backend: quickjs | |
- name: reset | |
shell: bash | |
run: | | |
cd $GITHUB_WORKSPACE | |
rm -rf unity/Assets/core/upm/Plugins | |
- name: BuildiOSNodeJS | |
uses: ./.github/workflows/composites/unity-build-plugins/ios/ | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
backend: nodejs_16 | |
osx: | |
runs-on: macos-11 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: BuildOSX | |
uses: ./.github/workflows/composites/unity-build-plugins/osx/ | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
backend: v8_9.4 | |
- name: reset | |
shell: bash | |
run: | | |
cd $GITHUB_WORKSPACE | |
rm -rf unity/Assets/core/upm/Plugins | |
- name: BuildOSXNodejs | |
uses: ./.github/workflows/composites/unity-build-plugins/osx/ | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
backend: nodejs_16 | |
- name: reset | |
shell: bash | |
run: | | |
cd $GITHUB_WORKSPACE | |
rm -rf unity/Assets/core/upm/Plugins | |
- name: BuildOSXQuickJS | |
uses: ./.github/workflows/composites/unity-build-plugins/osx/ | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
backend: quickjs | |
windows: | |
runs-on: windows-2019 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: BuildWindows | |
uses: ./.github/workflows/composites/unity-build-plugins/windows/ | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
backend: v8_9.4 | |
- name: reset | |
shell: bash | |
run: | | |
cd $GITHUB_WORKSPACE | |
rm -rf unity/Assets/core/upm/Plugins | |
- name: BuildWindowsQuickjs | |
uses: ./.github/workflows/composites/unity-build-plugins/windows/ | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
backend: quickjs | |
- name: reset | |
shell: bash | |
run: | | |
cd $GITHUB_WORKSPACE | |
rm -rf unity/Assets/core/upm/Plugins | |
- name: BuildWindowsNodeJS | |
uses: ./.github/workflows/composites/unity-build-plugins/windows/ | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
backend: nodejs_16 | |
linux64: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: BuildLinux | |
uses: ./.github/workflows/composites/unity-build-plugins/linux/ | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
backend: v8_9.4 | |
- name: BuildLinuxNodeJS | |
uses: ./.github/workflows/composites/unity-build-plugins/linux/ | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
backend: nodejs_16 | |
publish: | |
runs-on: ubuntu-latest | |
needs: [windows,osx,ios,android,linux64] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Retrieve version | |
run: | | |
echo "API_LEVEL=$(cat unity/native_src/Src/Puerts.cpp | grep -Po '(?<=API_LEVEL\s)(\d+)')" >> $GITHUB_ENV | |
node -e "const pjson = JSON.parse(fs.readFileSync('$GITHUB_WORKSPACE/unity/Assets/core/upm/package.json', 'utf-8')); pjson.version = '${{ github.event.inputs.tag_name }}' ; fs.writeFileSync('$GITHUB_WORKSPACE/unity/Assets/core/upm/package.json', JSON.stringify(pjson))" | |
- uses: actions/download-artifact@v1 | |
with: | |
name: Unity_Plugins (v8_9.4_Release) | |
path: V8/upm/Plugins/ | |
- uses: actions/download-artifact@v1 | |
with: | |
name: Unity_Plugins (quickjs_Release) | |
path: Quickjs/upm/Plugins/ | |
- uses: actions/download-artifact@v1 | |
with: | |
name: Unity_Plugins (nodejs_16_Release) | |
path: Nodejs/upm/Plugins/ | |
- name: Create Release Asset | |
run: | | |
cp $GITHUB_WORKSPACE/LICENSE $GITHUB_WORKSPACE/unity/Assets/core/upm | |
ls -l $GITHUB_WORKSPACE/unity/Assets/core/upm | |
cd V8/ && cp -r $GITHUB_WORKSPACE/unity/Assets/core/upm . && tar cvfz ../PuerTS_V8_${{ github.event.inputs.tag_name }}.tgz upm && cd - | |
cd Quickjs/ && cp -r $GITHUB_WORKSPACE/unity/Assets/core/upm . && tar cvfz ../PuerTS_Quickjs_${{ github.event.inputs.tag_name }}.tgz upm && cd - | |
cd Nodejs/ && cp -r $GITHUB_WORKSPACE/unity/Assets/core/upm . && tar cvfz ../PuerTS_Nodejs_${{ github.event.inputs.tag_name }}.tgz upm && cd - | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
body: | | |
中文版本请查看 [`doc/unity/zhcn/changelog.md`](https://github.com/Tencent/puerts/blob/master/doc/unity/zhcn/changelog.md) | |
> difference between Node.js/Quickjs/V8: [wiki](https://github.com/Tencent/puerts/wiki/%5BUnity%5D-Release%E9%87%8C%E5%90%84%E4%B8%AAPlugin%E7%9A%84%E5%8C%BA%E5%88%AB) | |
tag_name: Unity_v${{ github.event.inputs.tag_name }} | |
release_name: Unity_v${{ github.event.inputs.tag_name }},ApiLevel:${{ env.API_LEVEL }} | |
draft: false | |
prerelease: false | |
- name: Upload V8 Plugins | |
#id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./PuerTS_V8_${{ github.event.inputs.tag_name }}.tgz | |
asset_name: PuerTS_V8_${{ github.event.inputs.tag_name }}.tgz | |
asset_content_type: application/tgz | |
- name: Upload Quickjs Plugins | |
#id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./PuerTS_Quickjs_${{ github.event.inputs.tag_name }}.tgz | |
asset_name: PuerTS_Quickjs_${{ github.event.inputs.tag_name }}.tgz | |
asset_content_type: application/tgz | |
- name: Upload Nodejs Plugins | |
#id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./PuerTS_Nodejs_${{ github.event.inputs.tag_name }}.tgz | |
asset_name: "PuerTS_Nodejs_${{ github.event.inputs.tag_name }}.tgz" | |
asset_content_type: application/tgz | |
# - name: Trigger demo/upm repository update | |
# run: | | |
# curl -XPOST -u "${{ secrets.PAT_USERNAME}}:${{secrets.PAT_TOKEN}}" -H "Accept: application/vnd.github.v3+json" -H "Content-Type: application/json" https://api.github.com/repos/zombieyang/puerts_unity_demo/actions/workflows/sync-package.yml/dispatches -d '{"ref": "master", "inputs": {"push_tag_version": "${{ github.event.inputs.tag_name }}"}}' |