Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

リリース用のワークフローを追加 #1

Merged
merged 7 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Build

on:
workflow_call:
outputs:
version:
value: ${{ jobs.build.outputs.version }}

env:
PACKAGE_NAME: dev.paltee.avatar-aid

jobs:
build:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.value }}
steps:
- name: Setup package path
run: echo "PACKAGE_PATH=Packages/${{ env.PACKAGE_NAME }}" >> $GITHUB_ENV

- name: Checkout repository
uses: actions/checkout@v4
with:
path: "${{ env.PACKAGE_PATH }}"

- name: Read package version
id: version
run: echo "value=$(cat "${{ env.PACKAGE_PATH }}/package.json" | jq -r '.version')" >> $GITHUB_OUTPUT

- name: Setup environment variables
run: |
echo "ZIP_FILE_PATH=${{ env.PACKAGE_NAME }}-${{ steps.version.outputs.value }}.zip" >> $GITHUB_ENV
echo "UNITY_PACKAGE_PATH=${{ env.PACKAGE_NAME }}-${{ steps.version.outputs.value }}.unitypackage" >> $GITHUB_ENV
echo "VERSION=${{ steps.version.outputs.value }}" >> $GITHUB_ENV

- name: Create ZIP file
working-directory: ${{ env.PACKAGE_PATH }}
run: zip -r "${{ github.workspace }}/${{ env.ZIP_FILE_PATH }}" . -x '.*' 'Tests/*' Tests.meta

- name: Create meta files list
run: find "${{ env.PACKAGE_PATH }}" -type f -name "*.meta" | grep -Ev "^${{ env.PACKAGE_PATH }}/Tests" > metaList

- name: Create Unity package
uses: pCYSl5EDgo/create-unitypackage@master
with:
package-path: ${{ env.UNITY_PACKAGE_PATH }}
include-files: metaList

- name: Copy package.json
run: cp ${{ env.PACKAGE_PATH }}/package.json package.json

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: Artifacts
path: |
${{ env.UNITY_PACKAGE_PATH }}
${{ env.ZIP_FILE_PATH }}
package.json
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build and Release

on:
workflow_dispatch:

jobs:
build:
uses: ./.github/workflows/build.yml

release:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifacts
uses: actions/download-artifact@v4

- name: Check existing release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ "$(gh release view --repo ${{ github.repository }} ${{ needs.build.outputs.version }} 2>&1)" != 'release not found' ]; then
echo "Release already exists"
exit 1
fi

- name: Create release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.build.outputs.version }}
draft: true
files: |
Artifacts/*
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
- reopened

jobs:
build:
uses: ./.github/workflows/build.yml

test:
name: Test
runs-on: ubuntu-latest
Expand Down