Merge pull request #72 from 4sllan/feat/add-provider-lucide #18
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: 🚀 Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' # Trigger only on version tags like v1.0.0 | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| id-token: write # necessário para --provenance | |
| steps: | |
| # 📥 Checkout repository | |
| - name: 📥 Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| # 📦 Enable pnpm | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| # 🟢 Setup Node.js | |
| - name: 🟢 Setup Node.js | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: 20 | |
| cache: 'pnpm' | |
| registry-url: 'https://registry.npmjs.org/' # Importante! | |
| # 📦 Install dependencies | |
| - name: 📦 Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| # 🏗 Build package | |
| - name: 🏗 Build package | |
| run: pnpm build | |
| # 🔎 Verify tag version matches package.json | |
| - name: 🔎 Validate version | |
| run: | | |
| # Extrai apenas o nome da tag (remove refs/tags/) | |
| TAG_FULL="${GITHUB_REF_NAME#refs/tags/}" # v1.3.0 | |
| TAG_VERSION="${TAG_FULL#v}" # 1.3.0 | |
| PACKAGE_VERSION=$(node -p "require('./package.json').version") | |
| echo "Tag version: $TAG_VERSION" | |
| echo "Package version: $PACKAGE_VERSION" | |
| if [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then | |
| echo "❌ Tag version does not match package.json version" | |
| exit 1 | |
| fi | |
| # ✅ Verify CHANGELOG exists | |
| - name: ✅ Verify CHANGELOG.md | |
| run: | | |
| if [ ! -f CHANGELOG.md ]; then | |
| echo "❌ CHANGELOG.md not found!" | |
| exit 1 | |
| fi | |
| # 📄 Extract current version changelog | |
| - name: 📄 Extract current version changelog | |
| id: changelog | |
| run: | | |
| VERSION="${GITHUB_REF_NAME#refs/tags/}" | |
| VERSION_NUMBER="${VERSION#v}" | |
| awk -v ver="$VERSION_NUMBER" ' | |
| /^## / { | |
| heading = $0 | |
| sub(/^##[ ]*/, "", heading) # Remove ## | |
| sub(/^\[/, "", heading) # Remove [ | |
| sub(/\]$/, "", heading) # Remove ] | |
| sub(/^v/, "", heading) # Remove v | |
| flag = (heading == ver) | |
| next | |
| } | |
| flag | |
| ' CHANGELOG.md > temp_changelog.md | |
| if [ ! -s temp_changelog.md ]; then | |
| echo "❌ No changelog section found for version ${VERSION} in CHANGELOG.md" | |
| exit 1 | |
| fi | |
| echo "BODY<<EOF" >> $GITHUB_ENV | |
| cat temp_changelog.md >> $GITHUB_ENV | |
| echo "EOF" >> $GITHUB_ENV | |
| # 🚀 Publish to npm | |
| - name: 🚀 Publish to npm | |
| run: pnpm publish --provenance --access public --no-git-checks | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| # 🚀 Create GitHub Release | |
| - name: 🚀 Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: 🚀 Release ${{ github.ref_name }} | |
| body: ${{ env.BODY }} | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |