Skip to content

Release

Release #26

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
tag:
description: "tag: git tag you want create. (sample 1.0.0)"
required: true
env:
GIT_TAG: ${{ github.event.inputs.tag }}
permissions:
contents: write
jobs:
update-packagejson:
runs-on: ubuntu-latest
env:
TARGET_FILE: ./Assets/MackySoft/MackySoft.SerializeReferenceExtensions/package.json
outputs:
sha: ${{ steps.commit.outputs.sha }}
steps:
- uses: actions/checkout@v4
- name: Output package.json (Before)
run: cat ${{ env.TARGET_FILE}}
- name: Update package.json to version ${{ env.GIT_TAG }}
run: sed -i -e "s/\(\"version\":\) \"\(.*\)\",/\1 \"${{ env.GIT_TAG }}\",/" ${{ env.TARGET_FILE }}
- name: Check update
id: check_update
run: |
cat ${{ env.TARGET_FILE}}
if ! git diff --exit-code; then
echo "changed=1" >> "$GITHUB_OUTPUT"
fi
- name: Commit files
id: commit
if: steps.check_update.outputs.changed == '1'
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "feat: Update package.json to ${{ env.GIT_TAG }}" -a
echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
- name: Check sha
run: echo "SHA ${SHA}"
env:
SHA: ${{ steps.commit.outputs.sha }}
- name: Create Tag
if: steps.check_update.outputs.changed == '1'
run: git tag ${{ env.GIT_TAG }}
- name: Push changes
if: steps.check_update.outputs.changed == '1'
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
tags: true
build:
needs: [update-packagejson]
strategy:
matrix:
unity: ["2021.3.45f2"]
include:
- unityVersion: 2021.3.45f2
license: UNITY_LICENSE
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- run: echo ${{ needs.update-packagejson.outputs.sha }}
- uses: actions/checkout@v4
with:
ref: ${{ needs.update-packagejson.outputs.sha }}
- name: Export unitypackage
uses: game-ci/unity-builder@v4
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
projectPath: .
unityVersion: ${{ matrix.unityVersion }}
targetPlatform: StandaloneLinux64
buildMethod: MackySoft.PackageTools.Editor.UnityPackageExporter.Export
versioning: None
- name: check all .meta is commited
run: |
if git ls-files --others --exclude-standard -t | grep --regexp='[.]meta$'; then
echo "Detected .meta file generated. Do you forgot commit a .meta file?"
exit 1
else
echo "Great, all .meta files are commited."
fi
working-directory: .
# Store artifacts.
- uses: actions/upload-artifact@v4
with:
name: SerializeReference-Extensions.unitypackage
path: ./Build/SerializeReference-Extensions.unitypackage
create-release:
needs: [update-packagejson, build]
runs-on: ubuntu-latest
steps:
# Download(All) Artifacts to current directory
- uses: actions/download-artifact@v4
# Create release and upload unitypackage.
- uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.GIT_TAG }}
name: ${{ env.GIT_TAG }}
target_commitish: ${{ needs.update-packagejson.outputs.sha }}
draft: true
prerelease: false
files: SerializeReference-Extensions.unitypackage/SerializeReference-Extensions.unitypackage