Skip to content

deploy-build

deploy-build #8

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}" -o htmlplayer-build.zip "${ARTIFACT_URL}"
unzip htmlplayer-build.zip -d temp-build
- name: Debug download
working-directory: temp-build
run: |
ls -la htmlplayer-build.zip
file htmlplayer-build.zip # Should show "Zip archive data" if valid
- name: Clear and copy to subfolder
run: |
SUBFOLDER="${{ github.event.client_payload.subfolder }}"
echo "Copying to ${SUBFOLDER}"
ls "${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