-
-
Notifications
You must be signed in to change notification settings - Fork 160
206 lines (195 loc) · 6.91 KB
/
release.yml
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
name: Release - build & publish modules and server, build & publish docker containers
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
server-admin-ui-dependencies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- run: |
if [[ "$(npm view @signalk/server-admin-ui-dependencies version)" != "$(awk '/"version":/{gsub(/("|",)/,"",$2);print $2}' packages/server-admin-ui-dependencies/package.json)" ]]; then
cd packages/server-admin-ui-dependencies
npm install --package-lock-only
npm ci && npm cache clean --force
npm publish --access public
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
server-admin-ui:
runs-on: ubuntu-latest
needs: server-admin-ui-dependencies
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- run: |
if [[ "$(npm view @signalk/server-admin-ui version)" != "$(awk '/"version":/{gsub(/("|",)/,"",$2);print $2}' packages/server-admin-ui/package.json)" ]]; then
cd packages/server-admin-ui
npm install --package-lock-only
npm ci && npm cache clean --force
npm publish --access public
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
server-api:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- run: |
if [[ "$(npm view @signalk/server-api version)" != "$(awk '/"version":/{gsub(/("|",)/,"",$2);print $2}' packages/server-api/package.json)" ]]; then
cd packages/server-api
npm install --package-lock-only
npm ci && npm cache clean --force
npm publish --access public
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
streams:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- run: |
if [[ "$(npm view @signalk/streams version)" != "$(awk '/"version":/{gsub(/("|",)/,"",$2);print $2}' packages/streams/package.json)" ]]; then
cd packages/streams
npm install --package-lock-only
npm ci && npm cache clean --force
npm publish --access public
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
resources-provider-plugin:
needs: server-api
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- run: |
if [[ "$(npm view @signalk/resources-provider version)" != "$(awk '/"version":/{gsub(/("|",)/,"",$2);print $2}' packages/resources-provider-plugin/package.json)" ]]; then
# to disable workspaces, otherwise npm will not install @signalk/server-api
rm package.json
cd packages/resources-provider-plugin
npm install --package-lock-only
npm ci && npm cache clean --force
npm publish --access public
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
signalk-server:
runs-on: ubuntu-latest
needs: [server-admin-ui, server-api, streams, resources-provider-plugin]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- name: Set tag variable
id: vars
run: echo ::set-output name=tag::$(echo ${GITHUB_REF#refs/*/})
- name: Install, build & publish
run: |
npm install --package-lock-only
npm ci && npm cache clean --force
if [[ "${{ steps.vars.outputs.tag }}" == *beta* ]];
then
npm publish --tag beta
else
npm publish
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
release:
permissions:
contents: write
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v1
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PAT }}
- name: Create Release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: ${{steps.github_release.outputs.changelog}}
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PAT }}
docker_image:
runs-on: ubuntu-latest
needs: signalk-server
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v5
with:
images: |
signalk/signalk-server
ghcr.io/signalk/signalk-server
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: signalkci
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PAT }} # Personal access tokens (classic) with a scope of "write:packages" is needed to release ghcr.io package registry.
- name: Set TAG for build-args
id: vars
run: echo ::set-output name=tag::$(echo ${GITHUB_REF#refs/*/})
- name: Build and push
uses: docker/build-push-action@v5
with:
file: ./docker/Dockerfile_rel
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
build-args: |
TAG=${{ steps.vars.outputs.tag }}
deploy_fly:
runs-on: ubuntu-latest
needs: docker_image
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup flyctl
uses: superfly/flyctl-actions/setup-flyctl@master
- name: Set TAG for build-arg
id: vars
run: echo ::set-output name=tag::$(echo ${GITHUB_REF#refs/*/})
- name: Deploy demo.signalk.org at fly.io
working-directory: ./fly_io/demo_signalk_org
run: flyctl deploy --remote-only --build-arg SK_VERSION=${{ steps.vars.outputs.tag }}
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}