diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..2255a81a --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,28 @@ +name: ๐Ÿš€ Deploy with Zip + +on: + workflow_dispatch: + inputs: + zip: + description: 'The url to the zip file' + required: true + +jobs: + deploy: + name: ๐Ÿš€ Deploy + runs-on: ubuntu-latest + permissions: + pages: write + id-token: write + steps: + - name: ๐Ÿ“ฆ Download zip file To '_site' + run: | + curl -L ${{ github.event.inputs.zip }} -o _site.zip + unzip _site.zip -d _site + find _site -name __MACOSX -exec rm -rf {} \; + + - name: ๐Ÿ“ฆ Upload '_site' + uses: actions/upload-pages-artifact@v2 + + - name: ๐Ÿš€ Deploy To GitHub Pages + uses: actions/deploy-pages@v2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..8b97d601 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,44 @@ +name: ๐Ÿ”– Release +run-name: ๐Ÿ”– Release (${{ github.ref_name }}) + +on: + workflow_dispatch: + push: + branches: + - preview + - main + - v*.x + tags-ignore: + - "**" + +jobs: + release: + name: ๐Ÿ”– Release (${{ github.ref_name }}) + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + issues: write + outputs: + channel: ${{ steps.release.outputs.new_release_channel }} + released: ${{ steps.release.outputs.new_release_published }} + tag: ${{ steps.release.outputs.new_release_git_tag }} + steps: + - name: ๐Ÿšš Checkout (${{ github.ref_name }}) + uses: actions/checkout@v4 + + - name: ๐Ÿ”– Run semantic release + uses: cycjimmy/semantic-release-action@v4 + id: release + with: + working_directory: Packages/src + extra_plugins: | + @semantic-release/changelog + @semantic-release/git + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + + - run: | + echo "๐Ÿ”– New release published: '${{ steps.release.outputs.new_release_published }}'" | tee -a $GITHUB_STEP_SUMMARY + echo "๐Ÿ”– New release channel: '${{ steps.release.outputs.new_release_channel }}'" | tee -a $GITHUB_STEP_SUMMARY + echo "๐Ÿ”– New release git tag: '${{ steps.release.outputs.new_release_git_tag }}'" | tee -a $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..bdff3122 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,103 @@ +# Required secrets +# UNITY_LICENSE: The contents of Unity license file +# UNITY_EMAIL: Unity user email to login +# UNITY_PASSWORD: Unity user password to login +name: ๐Ÿงช Test +run-name: ๐Ÿงช Test (${{ github.ref_name }}) + +env: + # MINIMUM_VERSION: The minimum version of Unity. + MINIMUM_VERSION: 2020.3 + # EXCLUDE_FILTER: The excluded versions of Unity. + EXCLUDE_FILTER: '(2020.2.0|2023.3)' + +on: + workflow_dispatch: + inputs: + usePeriodVersions: + description: 'Use the period versions (.0f1, .10f1, 20f1, ...).' + required: false + default: 'true' + push: + branches: + - develop + - develop-preview + tags: + - "!*" + paths-ignore: + - "*.md" + pull_request: + types: + - opened + - synchronize + +jobs: + setup: + name: โš™๏ธ Setup + runs-on: ubuntu-latest + outputs: + unityVersions: ${{ steps.setup.outputs.unityVersions }} + steps: + - name: โš™๏ธ Find target Unity versions + id: setup + run: | + echo "==== Target Unity Versions ====" + LATEST_VERSIONS=`npx unity-changeset list --versions --latest-patch --min ${MINIMUM_VERSION} --json --all` + if [ "${{ inputs.usePeriodVersions }}" = "true" ]; then + ADDITIONAL_VERSIONS=`npx unity-changeset list --versions --grep '0f' --min ${MINIMUM_VERSION} --json` + else + ADDITIONAL_VERSIONS=[] + fi + + VERSIONS=`echo "[${LATEST_VERSIONS}, ${ADDITIONAL_VERSIONS}]" \ + | jq -c '[ flatten | sort | unique | .[] | select( test("${{ env.EXCLUDE_FILTER }}") | not ) ]'` + echo "unityVersions=${VERSIONS}" | tee $GITHUB_OUTPUT + + test: + name: ๐Ÿงช Run tests + runs-on: ubuntu-latest + env: + UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} + UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} + UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} + permissions: + checks: write + contents: read + needs: setup + strategy: + fail-fast: false + max-parallel: 6 + matrix: + unityVersion: ${{ fromJson(needs.setup.outputs.unityVersions) }} + steps: + - name: ๐Ÿšš Checkout + uses: actions/checkout@v4 + + - name: ๐Ÿ“ฅ Cache library + uses: actions/cache@v4 + with: + path: Library + key: Library-${{ matrix.unityVersion }}-${{ github.sha }} + restore-keys: | + Library-${{ matrix.unityVersion }}- + Library- + + - name: ๐Ÿ› ๏ธ Build Unity Project (Test) + uses: game-ci/unity-builder@v4 + timeout-minutes: 45 + with: + customImage: ghcr.io/mob-sakai/unity3d:${{ matrix.unityVersion }} + targetPlatform: StandaloneLinux64 + allowDirtyBuild: true + customParameters: -nographics + + # - name: ๐Ÿงช Run tests + # uses: game-ci/unity-test-runner@v4 + # timeout-minutes: 45 + # with: + # customImage: ghcr.io/mob-sakai/unity3d:${{ matrix.unityVersion }} + # # unityVersion: ${{ matrix.unityVersion }} + # customParameters: -nographics + # checkName: ${{ matrix.unityVersion }} Test Results + # githubToken: ${{ github.token }} + # coverageOptions: "dontClear;generateHtmlReport;generateBadgeReport;pathFilters:+**/Packages/src/**;assemblyFilters:+,-*.Editor,-*.Test" diff --git a/Packages/src/.releaserc.json b/Packages/src/.releaserc.json new file mode 100644 index 00000000..50951733 --- /dev/null +++ b/Packages/src/.releaserc.json @@ -0,0 +1,24 @@ +{ + "branches": [ + "main", + "[0-9]+.x", + { + "name": "preview", + "prerelease": true + } + ], + "tagFormat": "${version}", + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "@semantic-release/changelog", + [ + "@semantic-release/npm", + { + "npmPublish": false + } + ], + "@semantic-release/git", + "@semantic-release/github" + ] +}