File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Deploy Build from Source
2+
3+ on :
4+ repository_dispatch :
5+ types : [deploy-build]
6+
7+ permissions :
8+ contents : write
9+
10+ jobs :
11+ deploy :
12+ runs-on : ubuntu-latest
13+ steps :
14+ - name : Checkout beta repo
15+ uses : actions/checkout@v4
16+ with :
17+ ref : main
18+
19+ - name : Download and extract build
20+ run : |
21+ SOURCE_REPO="${{ github.event.client_payload.source_repo }}"
22+ RELEASE_TAG="${{ github.event.client_payload.release_tag }}"
23+ ASSET_NAME="${{ github.event.client_payload.asset_name }}"
24+ ASSET_URL="https://github.com/${SOURCE_REPO}/releases/download/${RELEASE_TAG}/${ASSET_NAME}"
25+ curl -L -o build.zip "${ASSET_URL}"
26+ unzip build.zip -d temp-build
27+
28+ - name : Clear and copy to subfolder
29+ run : |
30+ SUBFOLDER="${{ github.event.client_payload.subfolder }}"
31+ rm -rf "${SUBFOLDER}"/*
32+ mkdir -p "${SUBFOLDER}"
33+ mv temp-build/* "${SUBFOLDER}/"
34+
35+ - name : Commit and push
36+ run : |
37+ SUBFOLDER="${{ github.event.client_payload.subfolder }}"
38+ SOURCE_REPO="${{ github.event.client_payload.source_repo }}"
39+ RELEASE_TAG="${{ github.event.client_payload.release_tag }}"
40+ git config --global user.name 'github-actions[bot]'
41+ git config --global user.email 'github-actions[bot]@users.noreply.github.com'
42+ git add "${SUBFOLDER}"
43+ if git diff --staged --quiet; then
44+ echo "No changes to commit"
45+ else
46+ git commit -m "Deploy ${SOURCE_REPO} build to ${SUBFOLDER} from release ${RELEASE_TAG}"
47+ git push origin main
48+ fi
You can’t perform that action at this time.
0 commit comments