deploy-build #4
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 Build from Source | |
| on: | |
| repository_dispatch: | |
| types: [deploy-build] | |
| permissions: | |
| contents: write | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout beta repo | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| - name: Download and extract build | |
| run: | | |
| ARTIFACT_URL="${{ github.event.client_payload.artifact_url }}" | |
| TOKEN="${{ secrets.BETA_PAT_TOKEN }}" | |
| curl -L -H "Authorization: token ${TOKEN}" htmlplayer-build.zip "${ARTIFACT_URL}" | |
| unzip htmlplayer-build.zip -d temp-build | |
| - name: Clear and copy to subfolder | |
| run: | | |
| SUBFOLDER="${{ github.event.client_payload.subfolder }}" | |
| rm -rf "${SUBFOLDER}"/* | |
| mkdir -p "${SUBFOLDER}" | |
| mv temp-build/* "${SUBFOLDER}/" | |
| - name: Commit and push | |
| run: | | |
| SUBFOLDER="${{ github.event.client_payload.subfolder }}" | |
| SOURCE_REPO="${{ github.event.client_payload.source_repo }}" | |
| git config --global user.name 'github-actions[bot]' | |
| git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
| git add "${SUBFOLDER}" | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "Deploy ${SOURCE_REPO} build to ${SUBFOLDER}" | |
| git push origin main | |
| fi |