Auto Release #1
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: Auto Release | |
on: | |
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: 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: | | |
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" |