-
Notifications
You must be signed in to change notification settings - Fork 12
95 lines (80 loc) · 3.51 KB
/
publish.yml
File metadata and controls
95 lines (80 loc) · 3.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Publish Release
on:
pull_request:
types:
- closed
branches:
- master
workflow_dispatch:
jobs:
publish:
# Only run if PR is merged and comes from 'release' branch (from the same repo), or if manually triggered
if: |
github.event_name == 'workflow_dispatch' ||
(github.event.pull_request.merged == true &&
github.event.pull_request.head.label == 'requestly:release')
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Release PR info
if: github.event_name != 'workflow_dispatch'
run: |
echo "🎉 Release PR merged!"
echo "📋 PR #${{ github.event.number }}"
echo "🌿 Branch: ${{ github.event.pull_request.head.ref }}"
- uses: actions/checkout@v6
- name: Configure git
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '24'
registry-url: 'https://registry.npmjs.org/'
- name: Install dependencies
run: npm ci
- name: Build package
run: npm run build
- name: Get package version
id: package-version
run: echo "current-version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Extract release notes
id: extract-release-notes
uses: ffurrer2/extract-release-notes@v3
############# TAG RELEASE ##############
- name: "Push tag v${{ steps.package-version.outputs.current-version }}"
uses: rickstaa/action-create-tag@v1
id: tag_version
with:
tag: "v${{ steps.package-version.outputs.current-version }}"
############# GITHUB RELEASE ##############
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
tag: "v${{ steps.package-version.outputs.current-version }}"
name: "v${{ steps.package-version.outputs.current-version }}"
body: ${{ steps.extract-release-notes.outputs.release_notes }}
############# NPM RELEASE ##############
- name: Publish to NPM
run: npm publish --provenance --access public # Add npm --tag (dist-tag) later
- name: Success notification
run: |
echo "::notice::✅ Successfully published @requestly/requestly-proxy@${{ steps.package-version.outputs.current-version }}"
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "✨ Release v${{ steps.package-version.outputs.current-version }} Published!"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "📦 NPM Package:"
echo " https://www.npmjs.com/package/@requestly/requestly-proxy"
echo ""
echo "🏷️ Git Tag:"
echo " v${{ steps.package-version.outputs.current-version }}"
echo ""
echo "📝 GitHub Release:"
echo " https://github.com/${{ github.repository }}/releases/tag/v${{ steps.package-version.outputs.current-version }}"
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"