update changelog for version 3.1.0; fix adapter inheritance and impor… #33
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: Create Release | |
| on: | |
| push: | |
| branches: stable | |
| tags: | |
| - 'v*.*.*' | |
| - 'v*.*.*-*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| create-release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Verify tag regex | |
| id: verify_tag_regex | |
| run: | | |
| TAG_NAME=$(echo "$GITHUB_REF" | sed -E 's|refs/tags/||') | |
| if echo "$TAG_NAME" | grep -qE '^v[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9._@#$%-]+)?$'; then | |
| echo "Tag format is valid." | |
| echo "valid_tag=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "ERROR: Tag does not match expected format 'vX.Y.Z' or 'vX.Y.Z-suffix'." | |
| echo "Tag: $TAG_NAME" | |
| echo "valid_tag=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Checkout stable branch | |
| if: steps.verify_tag_regex.outputs.valid_tag == 'true' | |
| uses: actions/checkout@v4 | |
| - name: Check that tag commit is on stable branch | |
| id: check_tag_commit_branch | |
| if: steps.verify_tag_regex.outputs.valid_tag == 'true' | |
| run: | | |
| TAG_COMMIT=$(git rev-parse "$GITHUB_SHA") | |
| git fetch origin stable | |
| STABLE_COMMIT=$(git rev-parse origin/stable) | |
| if git merge-base --is-ancestor "$TAG_COMMIT" "$STABLE_COMMIT" || [ "$TAG_COMMIT" = "$STABLE_COMMIT" ]; then | |
| echo "Tag commit is on stable branch." | |
| echo "valid_tag=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "ERROR: Tag commit ($TAG_COMMIT) is not on stable branch ($STABLE_COMMIT)." | |
| echo "valid_tag=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Extract latest release notes from CHANGELOG.md | |
| if: steps.check_tag_commit_branch.outputs.valid_tag == 'true' | |
| id: changelog | |
| run: | | |
| RELEASE_NOTES=$(awk '/^## /{i++; if(i==2) exit} i==1' CHANGELOG.md | sed '1d') | |
| echo "release_notes<<EOF" >> $GITHUB_OUTPUT | |
| echo "$RELEASE_NOTES" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Check for existing release with same name | |
| if: steps.check_tag_commit_branch.outputs.valid_tag == 'true' | |
| id: check_existing_release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release list --repo "$GITHUB_REPOSITORY" --limit 100 --json name | jq -e ".[] | select(.name == \"Release ${{ github.ref_name }}\")" > /dev/null && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT | |
| shell: bash | |
| - name: Create GitHub Release | |
| if: steps.check_tag_commit_branch.outputs.valid_tag == 'true' && steps.check_existing_release.outputs.exists == 'false' | |
| uses: ncipollo/release-action@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| name: Release ${{ github.ref_name }} | |
| tag: ${{ github.ref_name }} | |
| draft: true | |
| body: ${{ steps.changelog.outputs.release_notes }} |