Skip to content

🕷️ The BEST Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev

build: New workflow to automatically create releases from PRs on main

Karim shoair55802bac974d
diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml
new file mode 100644
index 0000000..c6a6699
--- /dev/null
+++ b/.github/workflows/auto-release.yml
@@ -0,0 +1,49 @@
+name: Create Release
+
+on:
+ pull_request:
+ types: [closed]
+ branches:
+ - main
+
+jobs:
+ create-release:
+ if: github.event.pull_request.merged == true
+ runs-on: ubuntu-latest
+ permissions:
+ contents: write
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Get PR information
+ id: pr_data
+ run: |
+ echo "title=${{ github.event.pull_request.title }}" >> $GITHUB_OUTPUT
+ echo "body<<EOF" >> $GITHUB_OUTPUT
+ echo "${{ github.event.pull_request.body }}" >> $GITHUB_OUTPUT
+ echo "EOF" >> $GITHUB_OUTPUT
+
+ - name: Extract version
+ id: extract_version
+ run: |
+ PR_TITLE="${{ steps.pr_data.outputs.title }}"
+ if [[ $PR_TITLE =~ ^v ]]; then
+ echo "version=$PR_TITLE" >> $GITHUB_OUTPUT
+ echo "Valid version format found in PR title: $PR_TITLE"
+ else
+ echo "Error: PR title must start with 'v' to make a new release"
+ exit 1
+ fi
+
+ - name: Create Release
+ uses: softprops/action-gh-release@v1
+ with:
+ tag_name: ${{ steps.extract_version.outputs.version }}
+ name: Release ${{ steps.extract_version.outputs.version }}
+ body: ${{ steps.pr_data.outputs.body }}
+ draft: false
+ prerelease: false
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file