Skip to content

Commit

Permalink
Update auto-release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
richardadonnell committed Nov 24, 2024
1 parent d27842a commit 60ce857
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
name: Auto Release

on:
push:
paths:
- "releases/*.zip"
workflow_run:
workflows: ["Create Release ZIP"]
types:
- completed
branches:
- main

jobs:
create-release:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v39
with:
files: releases/*.zip
- name: Find latest zip file
id: find-zip
run: |
LATEST_ZIP=$(ls -t releases/*.zip | head -n 1)
echo "zip_file=$LATEST_ZIP" >> $GITHUB_OUTPUT
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
if [[ $file == releases/*.zip ]]; then
# Extract version from filename (assuming format: upwork-job-scraper-X.XX.zip)
VERSION=$(echo "$file" | sed -n 's/.*-\([0-9.]*\)\.zip$/\1/p')
FILENAME=$(basename "$file")
# Create and publish release
gh release create "$VERSION" \
--title "$FILENAME" \
--notes "" \
"$file"
fi
done
file="${{ steps.find-zip.outputs.zip_file }}"
# Extract version from filename (assuming format: upwork-job-scraper-X.XX.zip)
VERSION=$(echo "$file" | sed -n 's/.*-\([0-9.]*\)\.zip$/\1/p')
FILENAME=$(basename "$file")
# Create and publish release
gh release create "$VERSION" \
--title "$FILENAME" \
--notes "" \
"$file"

0 comments on commit 60ce857

Please sign in to comment.