From be0e6343287f2ac634efaee2345fbb95202b13ec Mon Sep 17 00:00:00 2001 From: tudor <7089284+tudddorrr@users.noreply.github.com> Date: Fri, 7 Mar 2025 18:09:10 +0000 Subject: [PATCH] hack to install scoped package deps via git --- .github/workflows/create-release.yml | 167 ++++++++++++++------------- 1 file changed, 89 insertions(+), 78 deletions(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 650ad6d..2ad4cdc 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -1,78 +1,89 @@ -name: Release - -on: - workflow_dispatch: - -jobs: - release: - runs-on: ubuntu-latest - - env: - COMMIT_EMAIL: 7089284+tudddorrr@users.noreply.github.com - COMMIT_MESSAGE: "Release https://github.com/TaloDev/unity/releases/tag/${{ github.ref_name }}" - - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version: 20 - - - name: Copy files - run: | - mkdir -p Release/Samples~ - cp -a Packages/com.trytalo.talo/. Release - cp -a Assets/Samples/. Release/Samples~ - - - name: Copy to package repo (main branch) - uses: tudddorrr/github-action-push-to-another-repository@main - if: "!contains(github.event.head_commit.message, '--no-release') && !contains(github.event.head_commit.message, 'pre.')" - env: - SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} - with: - source-directory: Release - destination-github-username: TaloDev - destination-repository-name: unity-package - user-email: ${{ env.COMMIT_EMAIL }} - commit-message: ${{ env.COMMIT_MESSAGE }} - - - name: Copy to package repo (version branch) - uses: tudddorrr/github-action-push-to-another-repository@main - env: - SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} - with: - source-directory: Release - destination-github-username: TaloDev - destination-repository-name: unity-package - user-email: ${{ env.COMMIT_EMAIL }} - commit-message: ${{ env.COMMIT_MESSAGE }} - target-branch: ${{ github.ref_name }} - - - name: Create artifact - run: | - cd Release - npm pack - - - name: Remove the version from the artifact name - run: | - filepath=$(ls Release/*.tgz) - new_filepath=$(echo "$filepath" | sed -E 's/-[0-9]+\.[0-9]+\.[0-9]+\.tgz$/.tgz/') - mv "$filepath" "$new_filepath" - - - name: Upload to itch - uses: manleydev/butler-publish-itchio-action@master - env: - BUTLER_CREDENTIALS: ${{ secrets.BUTLER_CREDENTIALS }} - CHANNEL: package - ITCH_GAME: talo-unity - ITCH_USER: sleepystudios - PACKAGE: Release/com.trytalo.talo.tgz - VERSION: ${{ github.ref_name }} - - - name: Create release - uses: softprops/action-gh-release@v2 - if: "!contains(github.event.head_commit.message, '--no-release')" - with: - generate_release_notes: true - prerelease: ${{ contains(github.event.head_commit.message, 'pre.') }} - files: Release/*.tgz +name: Release + +on: + workflow_dispatch: + +jobs: + release: + runs-on: ubuntu-latest + + env: + COMMIT_EMAIL: 7089284+tudddorrr@users.noreply.github.com + COMMIT_MESSAGE: "Release https://github.com/TaloDev/unity/releases/tag/${{ github.ref_name }}" + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Copy files + run: | + mkdir -p Release/Samples~ + cp -a Packages/com.trytalo.talo/. Release + cp -a Assets/Samples/. Release/Samples~ + + - name: Copy to package repo (main branch) + uses: tudddorrr/github-action-push-to-another-repository@main + if: "!contains(github.event.head_commit.message, '--no-release') && !contains(github.event.head_commit.message, 'pre.')" + env: + SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} + with: + source-directory: Release + destination-github-username: TaloDev + destination-repository-name: unity-package + user-email: ${{ env.COMMIT_EMAIL }} + commit-message: ${{ env.COMMIT_MESSAGE }} + + - name: Copy to package repo (version branch) + uses: tudddorrr/github-action-push-to-another-repository@main + env: + SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} + with: + source-directory: Release + destination-github-username: TaloDev + destination-repository-name: unity-package + user-email: ${{ env.COMMIT_EMAIL }} + commit-message: ${{ env.COMMIT_MESSAGE }} + target-branch: ${{ github.ref_name }} + + - name: Create artifact + run: | + cd Release + + SCOPED_PACKAGES='{ + "com.mikeschweitzer.websocket": "https://github.com/mikerochip/unity-websocket.git" + }' + + echo "$SCOPED_PACKAGES" | jq -r 'to_entries | .[] | .key + " " + .value' | while read -r package url; do + jq --arg pkg "$package" --arg url "$url" \ + '.dependencies[$pkg] = $url + "#" + .dependencies[$pkg]' \ + package.json > temp.json && mv temp.json package.json + done + + npm pack + + - name: Remove the version from the artifact name + run: | + filepath=$(ls Release/*.tgz) + new_filepath=$(echo "$filepath" | sed -E 's/-[0-9]+\.[0-9]+\.[0-9]+\.tgz$/.tgz/') + mv "$filepath" "$new_filepath" + + - name: Upload to itch + uses: manleydev/butler-publish-itchio-action@master + env: + BUTLER_CREDENTIALS: ${{ secrets.BUTLER_CREDENTIALS }} + CHANNEL: package + ITCH_GAME: talo-unity + ITCH_USER: sleepystudios + PACKAGE: Release/com.trytalo.talo.tgz + VERSION: ${{ github.ref_name }} + + - name: Create release + uses: softprops/action-gh-release@v2 + if: "!contains(github.event.head_commit.message, '--no-release')" + with: + generate_release_notes: true + prerelease: ${{ contains(github.event.head_commit.message, 'pre.') }} + files: Release/*.tgz