Scheduled weekly dependency update for week 50 #13
Workflow file for this run
This file contains hidden or 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: Semantic Release on Merge to Master | |
| on: | |
| pull_request: | |
| types: [closed] | |
| branches: [master] | |
| permissions: | |
| contents: write # nötig um Tags und Releases zu erstellen | |
| jobs: | |
| release: | |
| if: github.event.pull_request.merged == true | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # wir brauchen die gesamte Historie | |
| - name: Set up Git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Get latest tag | |
| id: get_latest_tag | |
| run: | | |
| git fetch --tags | |
| # Get latest semantic version tag (with or without 'v' prefix) | |
| # Sort tags properly by converting them to a comparable format | |
| TAG=$(git tag -l | grep -E '^[v]?[0-9]+\.[0-9]+(\.[0-9]+)?$' | sed 's/^v//' | sort -V | tail -n 1) | |
| # Re-add 'v' prefix if original tag had it | |
| ORIGINAL_TAG=$(git tag -l | grep -E "^[v]?${TAG}$" | tail -n 1) | |
| echo "latest_tag=${ORIGINAL_TAG}" >> $GITHUB_OUTPUT | |
| echo "Found latest tag: ${ORIGINAL_TAG}" | |
| - name: Determine next semantic version | |
| id: next_tag | |
| run: | | |
| LATEST=${{ steps.get_latest_tag.outputs.latest_tag }} | |
| if [ -z "$LATEST" ]; then | |
| LATEST="0.0.0" | |
| fi | |
| # Remove 'v' prefix if present | |
| VERSION=$(echo $LATEST | sed 's/^v//') | |
| MAJOR=$(echo $VERSION | cut -d. -f1) | |
| MINOR=$(echo $VERSION | cut -d. -f2) | |
| PATCH=$(echo $VERSION | cut -d. -f3) | |
| # Use proper commit range for log, handling both tagged and untagged repos | |
| if [ "$LATEST" = "0.0.0" ]; then | |
| COMMITS=$(git log --all --pretty=format:"%s%n%b") | |
| else | |
| COMMITS=$(git log $LATEST..HEAD --pretty=format:"%s%n%b") | |
| fi | |
| if echo "$COMMITS" | grep -q "BREAKING CHANGE"; then | |
| MAJOR=$((MAJOR + 1)) | |
| MINOR=0 | |
| PATCH=0 | |
| BUMP="major" | |
| elif echo "$COMMITS" | grep -q "^feat"; then | |
| MINOR=$((MINOR + 1)) | |
| PATCH=0 | |
| BUMP="minor" | |
| elif echo "$COMMITS" | grep -q "^fix"; then | |
| PATCH=$((PATCH + 1)) | |
| BUMP="patch" | |
| else | |
| PATCH=$((PATCH + 1)) | |
| BUMP="default patch" | |
| fi | |
| NEXT_TAG="${MAJOR}.${MINOR}.${PATCH}" | |
| echo "next_tag=${NEXT_TAG}" >> $GITHUB_OUTPUT | |
| echo "bump_type=${BUMP}" >> $GITHUB_OUTPUT | |
| - name: Generate release notes | |
| id: notes | |
| run: | | |
| LATEST=${{ steps.get_latest_tag.outputs.latest_tag }} | |
| if [ -z "$LATEST" ]; then | |
| NOTES=$(git log --oneline) | |
| else | |
| NOTES=$(git log $LATEST..HEAD --pretty=format:"- %s") | |
| fi | |
| echo "notes<<EOF" >> $GITHUB_OUTPUT | |
| echo "$NOTES" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Create tag (if missing) | |
| id: create_tag | |
| run: | | |
| TAG=${{ steps.next_tag.outputs.next_tag }} | |
| git fetch --tags | |
| if git rev-parse -q --verify "refs/tags/$TAG" >/dev/null; then | |
| echo "tag_exists=true" >> $GITHUB_OUTPUT | |
| echo "Tag $TAG already exists; skipping creation" | |
| else | |
| git tag "$TAG" | |
| if ! git push origin "$TAG" 2>&1; then | |
| echo "⚠️ Failed to push tag. Check repository rules at:" | |
| echo "https://github.com/${{ github.repository }}/rules?ref=refs%2Ftags%2F$TAG" | |
| echo "tag_exists=false" >> $GITHUB_OUTPUT | |
| exit 1 | |
| fi | |
| echo "tag_exists=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Check if release exists for tag | |
| id: check_release | |
| run: | | |
| TAG=${{ steps.next_tag.outputs.next_tag }} | |
| STATUS=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: Bearer ${GITHUB_TOKEN}" -H "Accept: application/vnd.github+json" "https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/$TAG") | |
| echo "release_status=$STATUS" >> $GITHUB_OUTPUT | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create GitHub Release (if missing) | |
| if: steps.check_release.outputs.release_status != '200' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.next_tag.outputs.next_tag }} | |
| name: "Release ${{ steps.next_tag.outputs.next_tag }}" | |
| body: | | |
| ### Changes | |
| ${{ steps.notes.outputs.notes }} | |
| **Version bump type:** ${{ steps.next_tag.outputs.bump_type }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |