Deploy Branch unity/v4.0 - Unity - 4.0 by @cdhanna #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy Docs Branch | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| branch: | |
| description: 'Enter branch to deploy (must exist in the repo)' | |
| required: true | |
| type: string | |
| sdk: | |
| description: 'Select SDK to deploy' | |
| required: true | |
| type: choice | |
| options: | |
| - Unity | |
| - Unreal | |
| - WebSDK | |
| version: | |
| description: 'Version to deploy (e.g., 4.0, 2.2, 0.6)' | |
| required: true | |
| type: string | |
| run-name: Deploy Branch ${{ github.event.inputs.branch }} - ${{ github.event.inputs.sdk }} - ${{ github.event.inputs.version }} by @${{ github.actor }} | |
| jobs: | |
| deploy: | |
| name: Deploy ${{ github.event.inputs.branch }} - ${{ github.event.inputs.sdk }} - ${{ github.event.inputs.version }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Checkout main branch first | |
| - name: Checkout main | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| # Run setup.sh | |
| - name: Run setup.sh | |
| run: bash setup.sh | |
| # Fetch all remote branches | |
| - name: Fetch remote branch names | |
| run: git fetch --depth=1 origin +refs/heads/*:refs/remotes/origin/* | |
| # Verify the branch exists | |
| - name: Verify branch exists | |
| run: | | |
| if ! git show-ref --verify --quiet refs/remotes/origin/${{ github.event.inputs.branch }}; then | |
| echo "Error: Branch '${{ github.event.inputs.branch }}' does not exist." | |
| exit 1 | |
| fi | |
| # Checkout the selected branch | |
| - name: Checkout selected branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.inputs.branch }} | |
| - name: Fetch gh-pages branch | |
| run: | | |
| git fetch origin gh-pages:gh-pages || echo "gh-pages does not exist yet" | |
| - name: Configure git for mike | |
| run: | | |
| git config --global user.name "${{ github.actor }}" | |
| git config --global user.email "${{ github.actor }}@users.noreply.github.com" | |
| # Deploy with mike | |
| - name: Deploy SDK with mike | |
| run: mike deploy "${{ github.event.inputs.sdk }}-${{ github.event.inputs.version }}" | |
| # Push gh_pages branch to remote | |
| - name: Push gh-pages branch | |
| run: | | |
| git config user.name "${{ github.actor }}" | |
| git config user.email "${{ github.actor }}@users.noreply.github.com" | |
| git checkout gh_pages | |
| git merge --no-ff ${{ github.event.inputs.branch }} | |
| git push origin gh-pages |