Skip to content

fix: rebase on pull #168

fix: rebase on pull

fix: rebase on pull #168

Workflow file for this run

name: Unity WebGL Automatic Build 👽✨🚀
on:
push:
branches:
- '1-configure-as-a-unity-package'
pull_request:
branches:
- 'main'
workflow_dispatch:
permissions:
contents: write # Permiso para escribir en el repositorio
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
# Checkout Repository
checkout:
name: Checkout Repository
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
token: ${{ secrets.PAT }}
- name: Echo Checkout Completed
run: echo "Repository has been successfully checked out."
# Create Temporary Branch and Sync with Main
sync-main:
name: Sync Temp Branch with Main
runs-on: ubuntu-22.04
needs: checkout
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
token: ${{ secrets.PAT }}
- name: Checkout deployment branch
run: |
echo "Checking out deployment branch: ${{ secrets.DEPLOYMENT_BRANCH }}"
git checkout ${{ secrets.DEPLOYMENT_BRANCH }}
- name: Create temporary branch from deployment branch
run: |
echo "Creating temporary branch"
git checkout -b temp
- name: Pull latest changes from main
run: |
echo "Pulling latest changes from main"
git pull origin main --rebase
- name: Echo Sync Main Completed
run: echo "Temporary branch has been successfully synced with main."
# Build Unity Project Job
build:
name: Build Unity Project
runs-on: ubuntu-22.04
needs: sync-main # This job depends on the "sync-main" job
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
token: ${{ secrets.PAT }}
- name: Pull Unity Image and Build Project
run: |
echo "Starting Unity build"
docker pull unityci/editor:ubuntu-2022.3.10f1-webgl-3.1.0
docker run --rm \
-v $GITHUB_WORKSPACE:/workspace \
-e UNITY_LICENSE=$UNITY_LICENSE \
-e UNITY_EMAIL=$UNITY_EMAIL \
-e UNITY_PASSWORD=$UNITY_PASSWORD \
-e UNITY_SERIAL=$UNITY_SERIAL \
-e UNITY_VERSION=2022.3.10f1 \
-e BUILD_PATH=$BUILD_PATH \
-e BUILD_NAME=WebGL \
-e BUILD_TARGET=WebGL \
unityci/editor:ubuntu-2022.3.10f1-webgl-3.1.0 /bin/bash -c "/workspace/entrypoint.sh"
- name: Echo Build Completed
run: echo "Unity build has completed successfully."
# Commit the Build Results and Push to Deployment Branch (if build is successful)
commit-and-push:
name: Commit and Push to Deployment Branch
runs-on: ubuntu-22.04
needs: build # This job depends on the "build" job
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
token: ${{ secrets.PAT }}
- name: Checkout deployment branch
run: |
echo "Checking out deployment branch: ${{ secrets.DEPLOYMENT_BRANCH }}"
git checkout ${{ secrets.DEPLOYMENT_BRANCH }}
- name: Merge temporary branch into deployment branch
run: |
echo "Merging changes from temp to deployment branch"
git merge temp --no-ff --commit -m "Merge build changes into deployment branch"
- name: Push changes to deployment branch
run: |
echo "Pushing changes to deployment branch"
git push origin ${{ secrets.DEPLOYMENT_BRANCH }}
- name: Echo Commit and Push Completed
run: echo "Changes have been successfully committed and pushed to the deployment branch."
# Upload Build Artifact
upload-artifact:
name: Upload Build Artifact
runs-on: ubuntu-22.04
needs: commit-and-push # This job depends on the "commit-and-push" job
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
token: ${{ secrets.PAT }}
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
name: build-artifact
path: ${{ secrets.BUILD_PATH }} # Ensure this points to the folder with the build output
- name: Echo Artifact Uploaded
run: echo "Build artifact has been uploaded successfully."
# Clean up temporary branch (always delete the temp branch)
cleanup:
name: Clean Up Temporary Branch
runs-on: ubuntu-22.04
needs: upload-artifact # This job depends on the "upload-artifact" job
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
token: ${{ secrets.PAT }}
- name: Delete temporary branch locally
run: |
echo "Deleting temporary branch"
git branch -D temp
- name: Delete temporary branch remotely
run: |
echo "Deleting temporary branch from remote"
git push origin --delete temp
- name: Echo Cleanup Completed
run: echo "Temporary branch has been deleted."