-
-
Notifications
You must be signed in to change notification settings - Fork 1
89 lines (76 loc) · 2.71 KB
/
Copy pathpublish.yml
File metadata and controls
89 lines (76 loc) · 2.71 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
name: 📨 Publish
on:
release:
types: published
permissions:
id-token: write
contents: read
jobs:
code_check:
name: 🔬 PR Checks
uses: ./.github/workflows/check.yml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
publish:
name: 📮 to npm
runs-on: ubuntu-latest
needs: code_check
environment:
name: ${{ github.event.release.prerelease && 'npm-prerelease' || 'npm' }}
url: ${{ github.event.release.html_url }}
concurrency:
group: publish-${{ github.event.release.tag_name }}
cancel-in-progress: true
steps:
- name: 🧾 Checkout
uses: actions/checkout@v6
- name: 🔎 Get package version
id: package_version
env:
IS_PRERELEASE: ${{ github.event.release.prerelease }}
run: |
PACKAGE_VERSION=$(jq -r '.version' package.json)
echo "Package version: $PACKAGE_VERSION"
if [[ "$IS_PRERELEASE" == "true" ]]; then
# For prereleases, version must contain -beta
if [[ "$PACKAGE_VERSION" != *"-beta"* ]]; then
echo "❌ Prerelease failed: Package version '$PACKAGE_VERSION' must contain '-beta'"
exit 1
fi
echo "version=beta" >> $GITHUB_OUTPUT
echo "✅ Prerelease version check passed"
else
# For releases, version must NOT contain -beta
if [[ "$PACKAGE_VERSION" == *"-beta"* ]]; then
echo "❌ Release failed: Package version '$PACKAGE_VERSION' cannot contain '-beta'"
exit 1
fi
echo "version=latest" >> $GITHUB_OUTPUT
echo "✅ Release version check passed"
fi
- uses: actions/setup-node@v4
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org/'
- name: 📦 Create build
run: |
npm install -g npm
corepack enable
yarn config set enableImmutableInstalls false
yarn
yarn build
- name: 📨 Publish to npm
env:
RELEASE_TAG: ${{ steps.package_version.outputs.version }}
run: npm publish --tag $RELEASE_TAG
- name: 📣 Send Discord Notification
if: ${{ !github.event.release.prerelease }}
uses: sarisia/actions-status-discord@v1
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
nodetail: true
url: ${{ github.event.release.html_url }}
title: 🚀 **RELEASE** **@digital-alchemy/synapse ${{ github.event.release.tag_name }}** published
content: |
(${{ github.event.release.tag_name }}) **${{ github.event.release.name }}**
${{ github.event.release.body }}