-
-
Notifications
You must be signed in to change notification settings - Fork 1
108 lines (101 loc) · 3.31 KB
/
Copy pathpublish.yml
File metadata and controls
108 lines (101 loc) · 3.31 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Publish
on:
release:
types: [published, prereleased]
permissions:
contents: read
jobs:
publish:
runs-on: ubuntu-latest
concurrency:
group: publish-${{ github.event.release.tag_name }}
cancel-in-progress: true
environment:
name: npm
url: ${{ github.event.release.html_url }}
services:
postgres:
image: postgres:15
env:
POSTGRES_PASSWORD: synapse_password
POSTGRES_USER: synapse_user
POSTGRES_DB: synapse
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: synapse_root_password
MYSQL_DATABASE: synapse
MYSQL_USER: synapse_user
MYSQL_PASSWORD: synapse_password
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
ports:
- 3306:3306
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v4
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org/'
- run: corepack enable
- run: yarn config set enableImmutableInstalls false
- run: yarn
- run: yarn build
- run: yarn lint
- run: yarn test
env:
DB_PG: postgresql://synapse_user:synapse_password@localhost:5432/synapse
DB_MYSQL: mysql://synapse_user:synapse_password@localhost:3306/synapse
- name: Check package version
env:
IS_PRERELEASE: ${{ github.event.release.prerelease }}
run: |
PACKAGE_VERSION=$(node -p "require('./package.json').version")
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 "✅ 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 "✅ Release version check passed"
fi
- name: Publish to npm
env:
IS_PRERELEASE: ${{ github.event.release.prerelease }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
if [[ "$IS_PRERELEASE" == "true" ]]; then
npm publish --tag beta
else
npm publish
fi
- 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 }}