-
Notifications
You must be signed in to change notification settings - Fork 3
204 lines (184 loc) · 7.82 KB
/
publish-pre-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
name: "publish-pre-release"
on:
push:
branches:
- main
jobs:
create-pre-release:
runs-on: ubuntu-latest
outputs:
latest_release_id: ${{ steps.latest_release_id.outputs.result }}
latest_release_version: ${{ steps.release.outputs.version }}
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"
- run: cargo install cargo-edit
- name: Install dependencies
run: npm clean-install
- name: Release
id: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_AUTHOR_NAME: oplabot
GIT_AUTHOR_EMAIL: oplabot@users.noreply.github.com
GIT_COMMITTER_NAME: oplabot
GIT_COMMITTER_EMAIL: oplabot@users.noreply.github.com
run: npx -p @semantic-release/exec -p @semantic-release/commit-analyzer -p @semantic-release/npm -p @semantic-release/github -p @semantic-release/release-notes-generator -p @semantic-release/changelog -p @semantic-release/git -p semantic-release semantic-release
- run: |
echo "ref_name= ${{ github.ref_name }}"
echo "version= ${{ steps.release.outputs.version }}"
# Get generated release id
- name: Get Latest Release id
if: steps.release.outputs.version && steps.release.outputs.version != ''
id: latest_release_id
uses: actions/github-script@v7
with:
script: |
const { data } = await github.rest.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: "v${{ steps.release.outputs.version }}"
})
return data.id
- name: Set latest release to draft
if: steps.release.outputs.version != ''
uses: actions/github-script@v7
env:
release_id: ${{ steps.latest_release_id.outputs.result }}
with:
script: |
github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: process.env.release_id,
draft: true,
prerelease: false
})
- uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
environment: 'production'
version: "v${{ steps.release.outputs.version }}"
build-pre-release:
needs: create-pre-release
if: needs.create-pre-release.outputs.latest_release_id
strategy:
fail-fast: false
matrix:
settings:
- platform: "macos-latest"
target: "x86_64-apple-darwin"
args: "--target x86_64-apple-darwin"
- platform: "macos-latest"
target: "aarch64-apple-darwin"
args: "--target aarch64-apple-darwin"
- platform: "ubuntu-20.04"
target: "x86_64-unknown-linux-gnu"
args: "--target x86_64-unknown-linux-gnu"
- platform: "windows-latest"
target: "x86_64-pc-windows-msvc"
args: "--target x86_64-pc-windows-msvc"
runs-on: ${{ matrix.settings.platform }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- name: setup node
uses: actions/setup-node@v4
with:
node-version: 20
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-darwin
- name: install dependencies (ubuntu only)
if: matrix.settings.platform == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
- name: Rustup add target # Do it for all ?
if: matrix.settings.target == 'x86_64-apple-darwin'
run: rustup target add ${{ matrix.settings.target }}
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: install frontend dependencies
run: npm instal
#- name: import windows certificate
# if: matrix.settings.platform == 'windows-latest'
# env:
# WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }}
# WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
# run: |
# New-Item -ItemType directory -Path certificate
# Set-Content -Path certificate/tempCert.txt -Value $env:WINDOWS_CERTIFICATE
# certutil -decode certificate/tempCert.txt certificate/certificate.pfx
# Remove-Item -path certificate -include tempCert.txt
# Import-PfxCertificate -FilePath certificate/certificate.pfx -CertStoreLocation Cert:\CurrentUser\My -Password (ConvertTo-SecureString -String $env:WINDOWS_CERTIFICATE_PASSWORD -Force -AsPlainText)
# If tagName and releaseId are omitted tauri-action will only build the app and won't try to upload any assets.
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
APPLE_API_KEY_PATH: ${{ secrets.APPLE_API_KEY_PATH }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
NEXT_PUBLIC_SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
SENTRY_RELEASE: "v${{ needs.create-pre-release.outputs.latest_release_version }}"
NEXT_PUBLIC_SENTRY_RELEASE: "v${{ needs.create-pre-release.outputs.latest_release_version }}"
with:
#tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version
#releaseName: "App v__VERSION__"
#releaseBody: "See the assets to download this version and install."
#releaseDraft: true
#prerelease: false
releaseId: ${{ needs.create-pre-release.outputs.latest_release_id }}
args: ${{ matrix.settings.args}}
undraft-pre-release:
needs: [create-pre-release,build-pre-release]
runs-on: ubuntu-latest
steps:
- name: Publish latest release
uses: actions/github-script@v7
env:
release_id: ${{ needs.create-pre-release.outputs.latest_release_id }}
with:
script: |
github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: process.env.release_id,
draft: false,
prerelease: false
})
modify-updater-gist:
needs: [create-pre-release,build-pre-release,undraft-pre-release]
uses: Opla/opla/.github/workflows/modify-updater-with-latest-release.yml@main
secrets: inherit