Skip to content

Commit

Permalink
Merge pull request #57 from openTdataCH/workflow_draft_release
Browse files Browse the repository at this point in the history
Create workflow_draft_release.yml
  • Loading branch information
deka91 authored Dec 11, 2024
2 parents d8681dc + 1f9e86b commit 0333e64
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/workflow_draft_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Create Draft Release

on:
pull_request:
types: [closed]

jobs:
create-draft-release:
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/')
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Extract version from branch name
run: |
if [[ "${{ github.event.pull_request.head.ref }}" =~ ^release/(.+)$ ]]; then
VERSION="${BASH_REMATCH[1]}"
echo "VERSION=${VERSION}" >> $GITHUB_ENV
else
echo "Branch name does not match 'release/' pattern"
exit 1
fi
- name: Create Tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git tag $VERSION
git push origin $VERSION
- name: Create Draft Release
uses: ncipollo/release-action@v1
with:
tag: ${{ env.VERSION }}
name: "v${{ env.VERSION }}"
commitish: main
generate_release_notes: true
draft: true
token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 0333e64

Please sign in to comment.