Skip to content

Commit

Permalink
Merge pull request #71 from richardadonnell/1.49
Browse files Browse the repository at this point in the history
1.49
  • Loading branch information
richardadonnell authored Nov 24, 2024
2 parents f284e3d + 91ecd4f commit b8e5eaa
Showing 1 changed file with 59 additions and 29 deletions.
88 changes: 59 additions & 29 deletions .github/workflows/zip-on-pr.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,79 @@
name: Create Zip on Pull Request
name: Create Release Zip

on:
pull_request:
push:
branches:
- main
workflow_dispatch: # Allow manual triggering

jobs:
create-zip:
runs-on: ubuntu-latest

steps:
# Step 1: Check out the repository code
- name: Check out code
uses: actions/checkout@v3

# Step 2: Get the branch name
- name: Get branch name
- name: Get version
id: vars
run: echo "branch_name=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
run: |
if [[ ${{ github.event_name }} == 'push' ]]; then
# Get short SHA of the commit
echo "version_tag=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
else
# For manual triggers, use timestamp
echo "version_tag=$(date +'%Y%m%d_%H%M%S')" >> $GITHUB_ENV
fi
- name: List files in repository
run: |
echo "Contents of upwork-job-scraper directory:"
ls -al upwork-job-scraper/
# Step 3: Prepare the zip file structure
- name: Create a zip file with specific files
run: |
mkdir -p temp/upwork-job-scraper
cp upwork-job-scraper/activityLog.js temp/upwork-job-scraper/
cp upwork-job-scraper/background.js temp/upwork-job-scraper/
cp upwork-job-scraper/errorHandling.js temp/upwork-job-scraper/
cp upwork-job-scraper/icon128.png temp/upwork-job-scraper/
cp upwork-job-scraper/icon48.png temp/upwork-job-scraper/
cp upwork-job-scraper/jobScraping.js temp/upwork-job-scraper/
cp upwork-job-scraper/manifest.json temp/upwork-job-scraper/
cp upwork-job-scraper/notifications.js temp/upwork-job-scraper/
cp upwork-job-scraper/sentry-init.js temp/upwork-job-scraper/
cp upwork-job-scraper/sentry.js temp/upwork-job-scraper/
cp upwork-job-scraper/settings.css temp/upwork-job-scraper/
cp upwork-job-scraper/settings.html temp/upwork-job-scraper/
cp upwork-job-scraper/settings.js temp/upwork-job-scraper/
cp upwork-job-scraper/utils.js temp/upwork-job-scraper/
cp upwork-job-scraper/webhook.js temp/upwork-job-scraper/
zip -r "upwork-job-scraper-${branch_name}.zip" temp/upwork-job-scraper/
mv "upwork-job-scraper-${branch_name}.zip" .
# Step 4: Upload the artifact (optional)
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.version_tag }}.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-${branch_name}"
path: "upwork-job-scraper-${branch_name}.zip"
name: "upwork-job-scraper-${{ env.version_tag }}"
path: "releases/upwork-job-scraper-${{ env.version_tag }}.zip"
retention-days: 5 # Keep artifacts for 5 days

0 comments on commit b8e5eaa

Please sign in to comment.