Skip to content

Commit dd4a058

Browse files
committed
restore: main.yml
1 parent e6fae73 commit dd4a058

File tree

1 file changed

+39
-20
lines changed

1 file changed

+39
-20
lines changed

.github/workflows/main.yml

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,42 @@ jobs:
3838
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}
3939

4040
- name: Git LFS Pull
41+
jobs:
42+
build:
43+
name: Unity Build 👽
44+
runs-on: ubuntu-latest
45+
steps:
46+
# Checkout (without LFS)
47+
- name: Checkout repository
48+
uses: actions/checkout@v2
49+
with:
50+
token: ${{secrets.PAT}}
51+
# Git LFS
52+
- name: Create LFS file list
53+
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
54+
55+
- name: Restore LFS cache
56+
uses: actions/cache@v2
57+
id: lfs-cache
58+
with:
59+
path: .git/lfs
60+
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}
61+
62+
- name: Git LFS Pull
4163
run: |
4264
git lfs pull
4365
git add .
44-
git reset --hard # Este paso se mantiene, pero considera si realmente es necesario
66+
git reset --hard
4567
46-
# Cache de dependencias de Unity
47-
- uses: actions/cache@v3
68+
# # Cache
69+
- uses: actions/cache@v2
4870
with:
4971
path: Library
5072
key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
5173
restore-keys: |
5274
Library-
5375
54-
# Build
76+
# # Build
5577
- name: Build project
5678
uses: game-ci/unity-builder@v2
5779
env:
@@ -62,43 +84,41 @@ jobs:
6284
targetPlatform: ${{ vars.TARGET_PLATFORM }}
6385
buildsPath: ${{ vars.BUILD_PATH }}
6486
allowDirtyBuild: true
65-
6687
# Output: Artifact
6788
- name: Upload Build Artifact
68-
uses: actions/upload-artifact@v3
89+
uses: actions/upload-artifact@v2
6990
with:
7091
name: ${{ vars.ARTIFACT_NAME }}
7192
path: ${{ vars.BUILD_PATH }}
72-
73-
# Despliegue a gh-pages
93+
# Deployment
7494
- name: Stash build result and reset local changes
7595
run: |
7696
echo "Applying initial configs"
97+
sudo chown -R $USER:$USER ${{ vars.BUILD_PATH }}
7798
git config --global user.email "${{ secrets.GH_EMAIL }}"
7899
git config --global user.name "${{ secrets.GH_USERNAME }}"
79100
echo "Stash and reset"
80101
git add ${{ vars.BUILD_PATH }}/${{ vars.TARGET_PLATFORM }}
81102
git stash push ${{ vars.BUILD_PATH }}/${{ vars.TARGET_PLATFORM }}
82103
git stash list
83-
git reset --hard # Solo cuando sea estrictamente necesario
84-
85-
- name: Limpiar rama gh-pages
104+
git reset --hard
105+
sudo git clean -d -x -f
106+
# Deployment
107+
- name: Cleaning gh-pages branch
86108
run: |
87109
echo "Switch to ${{ vars.DEPLOYMENT_BRANCH }}"
88110
git switch -f ${{ vars.DEPLOYMENT_BRANCH }}
89111
git reset --hard
90-
git clean -d -x -f
112+
sudo git clean -d -x -f
91113
rm -r *
92114
git add *
93-
git commit -m "Cleaning branch"
115+
git commit -m "cleaning branch"
94116
git push
95-
96-
- name: Aplicando archivos stashed a la rama gh-pages
117+
- name: Applying stashed files to ${{ vars.DEPLOYMENT_BRANCH }}
97118
run: |
98119
echo "Applying stash"
99120
git stash apply stash@{0}
100-
101-
- name: Copiar archivos al directorio raíz
121+
- name: Copying files to root directory
102122
run: |
103123
cd ${{ vars.BUILD_PATH }}/${{ vars.TARGET_PLATFORM }}/${{ vars.TARGET_PLATFORM }}
104124
ls
@@ -107,13 +127,12 @@ jobs:
107127
rm -r ${{ vars.BUILD_PATH }}
108128
ls
109129
pwd
110-
111130
- name: Pushing deployment to gh-pages branch
112131
run: |
113132
pwd
114133
git status
115134
git add *
116135
git commit -m "Deployment"
117136
git push
118-
git reset --hard # Este paso también podría optimizarse si no es necesario
119-
git clean -d -x -f
137+
git reset --hard
138+
sudo git clean -d -x -f

0 commit comments

Comments
 (0)