UniTask/.github/workflows/build-release.yml

111 lines
3.9 KiB
YAML
Raw Normal View History

2021-02-04 01:59:52 +08:00
name: build-release
2020-05-17 01:43:54 +08:00
on:
2021-02-04 01:59:52 +08:00
workflow_dispatch:
inputs:
tag:
description: "tag: git tag you want create. (sample 1.0.0)"
required: true
2022-07-26 12:10:40 +08:00
dry-run:
description: "dry-run: true will never create relase/nuget."
2021-02-04 01:59:52 +08:00
required: true
2022-07-26 12:10:40 +08:00
default: false
type: boolean
2021-02-04 01:59:52 +08:00
2020-05-17 01:43:54 +08:00
jobs:
2021-02-04 01:59:52 +08:00
update-packagejson:
2022-07-26 12:10:40 +08:00
uses: Cysharp/Actions/.github/workflows/update-packagejson.yaml@main
with:
file-path: ./src/UniTask/Assets/Plugins/UniTask/package.json
tag: ${{ inputs.tag }}
dry-run: ${{ inputs.dry-run }}
2021-02-04 01:59:52 +08:00
2020-05-17 01:43:54 +08:00
build-dotnet:
2021-02-04 01:59:52 +08:00
needs: [update-packagejson]
2020-06-04 14:14:40 +08:00
runs-on: ubuntu-latest
2021-02-04 01:59:52 +08:00
timeout-minutes: 10
2020-06-04 14:14:40 +08:00
steps:
2021-02-04 01:59:52 +08:00
- run: echo ${{ needs.update-packagejson.outputs.sha }}
2024-07-24 16:22:28 +08:00
- uses: actions/checkout@v4
2021-02-04 01:59:52 +08:00
with:
ref: ${{ needs.update-packagejson.outputs.sha }}
2022-07-26 12:10:40 +08:00
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
2020-06-04 14:14:40 +08:00
# build and pack
- run: dotnet build -c Release -p:Version=${{ inputs.tag }}
2020-06-04 14:14:40 +08:00
- run: dotnet test -c Release --no-build
- run: dotnet pack ./src/UniTask.NetCore/UniTask.NetCore.csproj -c Release --no-build -p:Version=${{ inputs.tag }} -o ./publish
2020-06-04 14:14:40 +08:00
# Store artifacts.
- uses: Cysharp/Actions/.github/actions/upload-artifact@main
2020-06-04 14:14:40 +08:00
with:
name: nuget
2021-02-04 01:59:52 +08:00
path: ./publish/
retention-days: 1
2020-05-17 01:43:54 +08:00
build-unity:
2021-02-04 01:59:52 +08:00
needs: [update-packagejson]
2020-05-17 01:43:54 +08:00
strategy:
matrix:
unity: ["2022.3.39f1"]
2020-05-17 01:43:54 +08:00
runs-on: ubuntu-latest
2021-02-04 01:59:52 +08:00
timeout-minutes: 15
2020-05-17 01:43:54 +08:00
steps:
2024-04-17 15:09:55 +08:00
- name: Load secrets
id: op-load-secret
uses: 1password/load-secrets-action@v2
with:
export-env: false
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN_PUBLIC }}
UNITY_EMAIL: "op://GitHubActionsPublic/UNITY_LICENSE/username"
UNITY_PASSWORD: "op://GitHubActionsPublic/UNITY_LICENSE/credential"
UNITY_SERIAL: "op://GitHubActionsPublic/UNITY_LICENSE/serial"
2021-02-08 18:32:53 +08:00
- run: echo ${{ needs.update-packagejson.outputs.sha }}
2024-07-24 16:22:28 +08:00
- uses: actions/checkout@v4
2021-02-08 18:32:53 +08:00
with:
ref: ${{ needs.update-packagejson.outputs.sha }}
2020-05-17 01:43:54 +08:00
# Execute scripts: Export Package
2021-02-08 15:53:46 +08:00
# /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export
- name: Build Unity (.unitypacakge)
uses: Cysharp/Actions/.github/actions/unity-builder@main
env:
2024-04-17 15:09:55 +08:00
UNITY_EMAIL: ${{ steps.op-load-secret.outputs.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ steps.op-load-secret.outputs.UNITY_PASSWORD }}
UNITY_SERIAL: ${{ steps.op-load-secret.outputs.UNITY_SERIAL }}
with:
projectPath: src/UniTask
unityVersion: ${{ matrix.unity }}
targetPlatform: StandaloneLinux64
buildMethod: PackageExporter.Export
2020-05-17 01:43:54 +08:00
2022-07-26 12:10:40 +08:00
- uses: Cysharp/Actions/.github/actions/check-metas@main # check meta files
with:
directory: src/UniTask
2021-02-04 01:59:52 +08:00
# Store artifacts.
- uses: Cysharp/Actions/.github/actions/upload-artifact@main
2020-05-17 01:43:54 +08:00
with:
name: UniTask.${{ inputs.tag }}.unitypackage
path: ./src/UniTask/UniTask.${{ inputs.tag }}.unitypackage
retention-days: 1
2020-05-17 01:43:54 +08:00
# release
2020-05-17 01:43:54 +08:00
create-release:
2021-02-04 01:59:52 +08:00
needs: [update-packagejson, build-dotnet, build-unity]
uses: Cysharp/Actions/.github/workflows/create-release.yaml@main
with:
commit-id: ${{ needs.update-packagejson.outputs.sha }}
dry-run: ${{ inputs.dry-run }}
tag: ${{ inputs.tag }}
nuget-push: true
release-upload: true
release-asset-path: ./UniTask.${{ inputs.tag }}.unitypackage/UniTask.${{ inputs.tag }}.unitypackage
secrets: inherit
2021-02-04 01:59:52 +08:00
cleanup:
if: ${{ needs.update-packagejson.outputs.is-branch-created == 'true' }}
2022-07-26 12:10:40 +08:00
needs: [update-packagejson, build-dotnet, build-unity]
uses: Cysharp/Actions/.github/workflows/clean-packagejson-branch.yaml@main
with:
branch: ${{ needs.update-packagejson.outputs.branch-name }}