chore(release): prepare to publish 0.0.2 #2
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: 🚀 Publish | |
on: | |
push: | |
tags: ['v[0-9]+.[0-9]+.[0-9]+'] | |
jobs: | |
publish: | |
name: Publish to pub.dev | |
permissions: | |
id-token: write # Required for authentication using OIDC to publish to pub.dev | |
contents: write # Required for creating a GitHub release and uploading the LICENSE file | |
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1 | |
github-release: | |
name: Create GitHub Release | |
needs: publish | |
runs-on: ubuntu-latest | |
steps: | |
- name: 📥 Checkout Repository | |
uses: actions/checkout@v4 | |
- name: 🏷️ Extract version from tag as pubspec.yaml version | |
id: extract_version | |
run: | | |
version=$(echo ${GITHUB_REF} | sed 's/^refs\/tags\/v\(.*\)$/\1/') | |
echo "VERSION=${version}" >> $GITHUB_OUTPUT | |
- name: 🔍 Validate extracted version format (should be pubspec.yaml valid version) | |
run: | | |
version=${{ steps.extract_version.outputs.VERSION }} | |
if [[ ! $version =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$ ]]; then | |
echo "❌ Invalid version format: $version. The version must be a valid pubspec.yaml version" | |
exit 1 | |
fi | |
- name: ✂️ Extract Release Notes from CHANGELOG.md | |
id: extract-release-notes | |
uses: ffurrer2/extract-release-notes@v2 | |
with: | |
changelog_file: CHANGELOG.md | |
release_notes_file: RELEASE_NOTES.md | |
- name: 🚀 Create a GitHub Release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "LICENSE" | |
bodyFile: "RELEASE_NOTES.md" | |
tag: ${{ github.ref_name }} | |
prerelease: ${{ contains(github.ref_name, '-') }} |