Skip to content
Merged
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
167 changes: 89 additions & 78 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -1,78 +1,89 @@
name: Release

on:
workflow_dispatch:

jobs:
release:
runs-on: ubuntu-latest

env:
COMMIT_EMAIL: [email protected]
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: [email protected]
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