Package in VPM-compatible format #15
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: Package in VPM-compatible format | |
on: | |
release: | |
types: | |
- published | |
workflow_dispatch: | |
inputs: | |
tag: | |
required: true | |
type: string | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.tag }} | |
- name: Add commit hash to the manifest | |
run: | | |
# moreutils はおそらく追加されない上インストールすると遅いので使わない | |
# see also: https://github.com/actions/runner-images/issues/5498 | |
jq --arg hash "$(git rev-parse HEAD)" '.version += ("+git." + $hash)' < package.json > package.json.tmp | |
mv package.json.tmp package.json | |
- name: Zip | |
run: | | |
# git のコミット履歴、GitHub用のファイル、Krita、Microsoft.Unity.AnalyzersはVPMパッケージのユーザーにとっては要らない。 | |
# そのためvpm-src.zipから除外する。 | |
zip -r vpm-src.zip . \ | |
--exclude '.git/**' \ | |
--exclude 'Doc~/Original/*' \ | |
--exclude 'Editor/0Analyzer/Microsoft.Unity.Analyzers.*' \ | |
--exclude '.github/**' | |
- name: Compute SHA256 | |
run: | | |
# sha256sumを使うと加工が非直感的だし、ここでスクリプト言語や外部バイナリを持ち出すと遅い。 | |
# PowerShell Coreを起動して回避。 | |
echo (Get-FileHash ./vpm-src.zip -Algorithm SHA256).Hash > vpm-src.zip.sha256sum | |
shell: pwsh | |
- name: Upload files | |
run: | | |
gh release upload ${{ github.event.release.tag_name || inputs.tag }} vpm-src.zip | |
gh release upload ${{ github.event.release.tag_name || inputs.tag }} vpm-src.zip.sha256sum | |
env: | |
GH_TOKEN: ${{ github.token }} |