Adds zip file for test. #1
Workflow file for this run
This file contains 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: Unzip and Deploy Marzipano Project | |
on: | |
push: | |
paths: | |
- 'uploads/*.zip' | |
jobs: | |
unzip_and_deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18.x' | |
- name: Extract and Deploy | |
run: | | |
# Create a temporary directory for extraction | |
mkdir temp_extraction | |
# Move to the uploads directory | |
cd uploads | |
# Loop through all ZIP files in the uploads directory | |
for zipfile in *.zip; do | |
# Extract the base name of the ZIP file (e.g., ProjectName) | |
project_name=$(basename "$zipfile" .zip) | |
# Unzip the file into the temporary directory | |
unzip "$zipfile" -d "../temp_extraction" | |
# Move back to the root directory | |
cd .. | |
# Rename the extracted app-files directory to the project name | |
mv "temp_extraction/$project_name/app-files" "$project_name" | |
# Remove the temporary extraction directory | |
rm -rf temp_extraction | |
# Move back to the uploads directory for the next iteration | |
cd uploads | |
done | |
# Clean up: remove all ZIP files from the uploads directory | |
rm -f *.zip | |
# Move back to the root directory | |
cd .. | |
# Configure Git | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
# Switch to the gh-pages branch | |
git fetch origin gh-pages | |
git checkout gh-pages | |
# Add the new or updated project directories | |
git add -A | |
# Commit the changes | |
git commit -m "Deploy updated Marzipano projects" | |
# Push the changes to the gh-pages branch | |
git push origin gh-pages |