-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #85 from richardadonnell/1.49
Update auto-release.yml
- Loading branch information
Showing
1 changed file
with
22 additions
and
21 deletions.
There are no files selected for viewing
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
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" |