-
-
Notifications
You must be signed in to change notification settings - Fork 19
191 lines (168 loc) · 5.65 KB
/
publish.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
name: Publish
permissions: write-all
on:
workflow_run:
workflows:
- Build & Test
types:
- completed
branches:
- main
workflow_dispatch:
inputs:
sha:
description: 'SHA to release from'
required: true
type: string
target:
description: 'Which targets to release'
required: true
default: 'all'
type: choice
options:
- all
- npm
- docker
- electron
concurrency: ${{ github.workflow }}-${{ github.event.workflow_run.head_sha || inputs.sha }}
env:
SHA: ${{ github.event.workflow_run.head_sha || inputs.sha }}
BUILD_CACHE_KEY: ${{ github.event.workflow_run.head_sha || inputs.sha }}
CACHED_BUILD_PATHS: |
${{ github.workspace }}/packages/*/dist
${{ github.workspace }}/packages/*/dist-bin
jobs:
npm:
name: NPM Package
runs-on: ubuntu-latest
if: >-
(github.event.workflow_run.conclusion == 'success'
&&
contains(github.event.workflow_run.head_commit.message, 'meta(changelog): Update package versions')
) || inputs.target == 'npm' || inputs.target == 'all'
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
ref: ${{ env.SHA }}
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
cache: 'pnpm'
- name: Setup NPM dependencies
run: pnpm install
- name: Restore build cache
uses: actions/cache/restore@v4
with:
enableCrossOsArchive: true
fail-on-cache-miss: true
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
- name: Publish to NPM
uses: changesets/action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
BUILD_PLATFORMS: 'linux-x64,linux-arm64,win-x64,darwin-x64,darwin-arm64'
with:
publish: pnpm changeset:publish
createGithubReleases: true
- name: Gets latest created release info
id: latest_release_info
uses: gregziegan/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file_glob: true
file: packages/spotlight/dist-bin/spotlight-*
tag: ${{ steps.latest_release_info.outputs.tag_name }}
make_latest: false
docker:
name: Docker Image
runs-on: ubuntu-latest
if: >-
(github.event.workflow_run.conclusion == 'success'
&&
contains(github.event.workflow_run.head_commit.message, 'meta(changelog): Update package versions')
) || inputs.target == 'docker' || inputs.target == 'all'
steps:
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-buildx-action@v3
- name: Push Docker Image as latest
run: >-
docker buildx imagetools create
--tag ghcr.io/getsentry/spotlight:latest
ghcr.io/getsentry/spotlight:$SHA
- name: Summarize
run: |
echo "**Tag:** ``ghcr.io/getsentry/spotlight:$SHA``" >> $GITHUB_STEP_SUMMARY
electron:
name: Electron Build
runs-on: macos-latest
if: >-
(github.event.workflow_run.conclusion == 'success'
&&
contains(github.event.workflow_run.head_commit.message, 'meta(changelog): Update package versions')
) || inputs.target == 'electron' || inputs.target == 'all'
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
ref: ${{ env.SHA }}
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
cache: 'pnpm'
- name: Setup dependencies
run: pnpm install
- name: Restore build cache
id: cache
uses: actions/cache/restore@v4
with:
enableCrossOsArchive: true
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
- name: Build
if: steps.cache.outputs.cache-hit != 'true'
run: pnpm --filter '@spotlightjs/electron...' build
- name: Build Electron
env:
APPLEID: ${{ secrets.APPLEID }}
APPLEIDPASS: ${{ secrets.APPLEIDPASS }}
TEAMID: ${{ secrets.TEAMID }}
CERT_PASS: ${{ secrets.CERT_PASS }}
MAIN_VITE_SENTRY_ORG: ${{ secrets.MAIN_VITE_SENTRY_ORG }}
MAIN_VITE_SENTRY_PROJECT: ${{ secrets.MAIN_VITE_SENTRY_PROJECT }}
MAIN_VITE_SENTRY_AUTH_TOKEN: ${{ secrets.MAIN_VITE_SENTRY_AUTH_TOKEN }}
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
run: cd packages/electron && pnpm build:mac
- name: Gets latest created release info
id: latest_release_info
uses: gregziegan/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: packages/electron/dist/*.zip
tag: ${{ steps.latest_release_info.outputs.tag_name }}
file_glob: true
make_latest: false