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: Create Zip on Pull Request | |
on: | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: # Allow manual triggering | |
jobs: | |
create-zip: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Get branch name | |
id: vars | |
run: | | |
if [[ ${{ github.event_name }} == 'pull_request' ]]; then | |
echo "branch_name=${{ github.head_ref }}" >> $GITHUB_ENV | |
else | |
echo "branch_name=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV | |
fi | |
- name: List files in repository | |
run: | | |
echo "Contents of upwork-job-scraper directory:" | |
ls -al upwork-job-scraper/ | |
- name: Create a zip file with specific files | |
run: | | |
mkdir -p upwork-job-scraper-temp | |
mkdir -p releases | |
files=( | |
activityLog.js | |
background.js | |
errorHandling.js | |
icon128.png | |
icon48.png | |
jobScraping.js | |
manifest.json | |
notifications.js | |
sentry-init.js | |
sentry.js | |
settings.css | |
settings.html | |
settings.js | |
utils.js | |
webhook.js | |
) | |
# Copy files to temporary directory | |
echo "Copying files..." | |
for file in "${files[@]}"; do | |
if [[ -f "upwork-job-scraper/$file" ]]; then | |
cp "upwork-job-scraper/$file" upwork-job-scraper-temp/ | |
echo "✓ Copied $file" | |
else | |
echo "❌ Error: upwork-job-scraper/$file does not exist." | |
exit 1 | |
fi | |
done | |
# Create zip with the correct structure | |
echo "Creating zip file..." | |
cd upwork-job-scraper-temp | |
zip -r "../releases/upwork-job-scraper-${{ env.branch_name }}.zip" . | |
cd .. | |
echo "✓ Zip file created successfully in releases folder" | |
- name: Upload zip file as artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "upwork-job-scraper-${{ env.branch_name }}" | |
path: "releases/upwork-job-scraper-${{ env.branch_name }}.zip" | |
retention-days: 5 # Keep artifacts for 5 days |