-
-
Notifications
You must be signed in to change notification settings - Fork 11
152 lines (136 loc) · 4.4 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
name: Publish
on:
push:
branches:
- main
paths:
- '**/CHANGELOG.md'
workflow_dispatch:
inputs:
nocache:
description: 'Do not rely on existing Docker layer cache'
default: false
type: boolean
docker:
description: 'Publish Docker package'
default: true
type: boolean
npm:
description: 'Publish NPM package (immutable)'
default: true
type: boolean
electron:
description: 'Publish Electron package'
default: true
type: boolean
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
npm:
name: NPM Package
runs-on: ubuntu-latest
# For whatever reason, yaml does not like the full "meta(changelog): Update package versions" string
# So we check this in two parts
if: |
(contains(github.event.head_commit.message, 'meta(changelog)')
&& contains(github.event.head_commit.message, 'Update package versions'))
|| inputs.npm
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
- name: Setup pnpm & install dependencies
uses: pnpm/action-setup@v4
with:
run_install: true
- name: Publish to NPM
uses: changesets/action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
with:
publish: pnpm changeset:publish
createGithubReleases: true
docker:
name: Docker Image
needs: npm
runs-on: ubuntu-latest
if: |
!cancelled()
&& (inputs.docker || github.event_name == 'push')
&& (needs.npm.result == 'success' || needs.npm.result == 'skipped')
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: .
cache-from: type=gha,scope=prod
no-cache: ${{ inputs.nocache == true }}
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/getsentry/spotlight:latest
ghcr.io/getsentry/spotlight:${{ github.sha }}
- name: Summarize
run: |
echo "**Tag:** ``ghcr.io/getsentry/spotlight:${{ github.sha }}``" >> $GITHUB_STEP_SUMMARY
electron:
name: Electron Build
needs: npm
runs-on: macos-latest
if: |
!cancelled()
&& (inputs.electron || github.event_name == 'push')
&& (needs.npm.result == 'success' || needs.npm.result == 'skipped')
# strategy:
# fail-fast: false
# matrix:
# platform: [x64, arm64]
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
- name: Setup pnpm & install dependencies
uses: pnpm/action-setup@v4
with:
run_install: true
- 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/fetch-latest-release@v2.0.0
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