Enhance error handling in generateEditUrl function and update .gitignore #10
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: Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Extract version from NEWS.md | |
| id: extract_version | |
| run: | | |
| VERSION=$(grep -m 1 "^# validation-zanzibar" NEWS.md | sed 's/# validation-zanzibar //') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "tag_name=v$VERSION" >> $GITHUB_OUTPUT | |
| echo "Extracted version: $VERSION" | |
| - name: Extract changelog for current version | |
| id: extract_changelog | |
| run: | | |
| CHANGELOG=$(awk '/^# validation-zanzibar/{if(p)exit;p=1;next} p' NEWS.md) | |
| echo "changelog<<EOF" >> $GITHUB_OUTPUT | |
| echo "$CHANGELOG" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Check if tag exists | |
| id: check_tag | |
| run: | | |
| if git rev-parse "${{ steps.extract_version.outputs.tag_name }}" >/dev/null 2>&1; then | |
| echo "exists=true" >> $GITHUB_OUTPUT | |
| echo "Tag ${{ steps.extract_version.outputs.tag_name }} already exists" | |
| else | |
| echo "exists=false" >> $GITHUB_OUTPUT | |
| echo "Tag ${{ steps.extract_version.outputs.tag_name }} does not exist" | |
| fi | |
| - name: Create GitHub Release | |
| if: steps.check_tag.outputs.exists == 'false' | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ steps.extract_version.outputs.tag_name }} | |
| name: Release ${{ steps.extract_version.outputs.version }} | |
| body: ${{ steps.extract_changelog.outputs.changelog }} | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Skip release (tag exists) | |
| if: steps.check_tag.outputs.exists == 'true' | |
| run: | | |
| echo "Skipping release creation - tag already exists" |