Skip to content

Commit 554200c

Browse files
committed
update: main-yml file
1 parent a1e5df6 commit 554200c

File tree

1 file changed

+24
-19
lines changed

1 file changed

+24
-19
lines changed

.github/workflows/main.yml

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
name: Unity WebGL Automatic Build 👽✨🚀
22
on:
3-
# push:
4-
# branches:
5-
# - 'main'
3+
push:
4+
branches:
5+
# - 'main'
6+
- 'origin/1-configure-as-a-unity-package'
67
pull_request:
78
branches:
89
- 'main'
@@ -19,11 +20,12 @@ jobs:
1920
name: Unity Build 👽
2021
runs-on: ubuntu-latest
2122
steps:
22-
# Checkout (without LFS)
23+
# Checkout (sin LFS)
2324
- name: Checkout repository
2425
uses: actions/checkout@v2
2526
with:
2627
token: ${{secrets.PAT}}
28+
2729
# Git LFS
2830
- name: Create LFS file list
2931
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
@@ -39,17 +41,17 @@ jobs:
3941
run: |
4042
git lfs pull
4143
git add .
42-
git reset --hard
44+
git reset --hard # Este paso se mantiene, pero considera si realmente es necesario
4345
44-
# # Cache
46+
# Cache de dependencias de Unity
4547
- uses: actions/cache@v2
4648
with:
4749
path: Library
4850
key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
4951
restore-keys: |
5052
Library-
5153
52-
# # Build
54+
# Build
5355
- name: Build project
5456
uses: game-ci/unity-builder@v2
5557
env:
@@ -60,41 +62,43 @@ jobs:
6062
targetPlatform: ${{ vars.TARGET_PLATFORM }}
6163
buildsPath: ${{ vars.BUILD_PATH }}
6264
allowDirtyBuild: true
65+
6366
# Output: Artifact
6467
- name: Upload Build Artifact
6568
uses: actions/upload-artifact@v2
6669
with:
6770
name: ${{ vars.ARTIFACT_NAME }}
6871
path: ${{ vars.BUILD_PATH }}
69-
# Deployment
72+
73+
# Despliegue a gh-pages
7074
- name: Stash build result and reset local changes
7175
run: |
7276
echo "Applying initial configs"
73-
sudo chown -R $USER:$USER ${{ vars.BUILD_PATH }}
7477
git config --global user.email "${{ secrets.GH_EMAIL }}"
7578
git config --global user.name "${{ secrets.GH_USERNAME }}"
7679
echo "Stash and reset"
7780
git add ${{ vars.BUILD_PATH }}/${{ vars.TARGET_PLATFORM }}
7881
git stash push ${{ vars.BUILD_PATH }}/${{ vars.TARGET_PLATFORM }}
7982
git stash list
80-
git reset --hard
81-
sudo git clean -d -x -f
82-
# Deployment
83-
- name: Cleaning gh-pages branch
83+
git reset --hard # Solo cuando sea estrictamente necesario
84+
85+
- name: Limpiar rama gh-pages
8486
run: |
8587
echo "Switch to ${{ vars.DEPLOYMENT_BRANCH }}"
8688
git switch -f ${{ vars.DEPLOYMENT_BRANCH }}
8789
git reset --hard
88-
sudo git clean -d -x -f
90+
git clean -d -x -f
8991
rm -r *
9092
git add *
91-
git commit -m "cleaning branch"
93+
git commit -m "Cleaning branch"
9294
git push
93-
- name: Applying stashed files to ${{ vars.DEPLOYMENT_BRANCH }}
95+
96+
- name: Aplicando archivos stashed a la rama gh-pages
9497
run: |
9598
echo "Applying stash"
9699
git stash apply stash@{0}
97-
- name: Copying files to root directory
100+
101+
- name: Copiar archivos al directorio raíz
98102
run: |
99103
cd ${{ vars.BUILD_PATH }}/${{ vars.TARGET_PLATFORM }}/${{ vars.TARGET_PLATFORM }}
100104
ls
@@ -103,12 +107,13 @@ jobs:
103107
rm -r ${{ vars.BUILD_PATH }}
104108
ls
105109
pwd
110+
106111
- name: Pushing deployment to gh-pages branch
107112
run: |
108113
pwd
109114
git status
110115
git add *
111116
git commit -m "Deployment"
112117
git push
113-
git reset --hard
114-
sudo git clean -d -x -f
118+
git reset --hard # Este paso también podría optimizarse si no es necesario
119+
git clean -d -x -f

0 commit comments

Comments
 (0)