-
-
Notifications
You must be signed in to change notification settings - Fork 81
193 lines (165 loc) · 6.32 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
name: "Release"
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
workflow_dispatch:
jobs:
continuous-integration:
uses: ./.github/workflows/ci.yml
create-release:
needs: continuous-integration
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
release_id: ${{ steps.create-release.outputs.result }}
steps:
- uses: actions/checkout@v4
- name: Get version
run: echo "PACKAGE_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
- name: Create release
id: create-release
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const changelogContent = fs.readFileSync('changelog.md', 'utf-8');
const regex = new RegExp(`(?<=\\[${process.env.PACKAGE_VERSION}\\]\\s)([\\s\\S]*?)(?=\\s## \\[)`, 'g');
const releaseNotes = changelogContent.match(regex)?.[0].trim() || '';
const { data } = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: `v${process.env.PACKAGE_VERSION}`,
name: `Seelen UI v${process.env.PACKAGE_VERSION}`,
body: releaseNotes,
generate_release_notes: true,
draft: true,
prerelease: false,
});
return data.id;
build-installers:
needs: create-release
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: "windows-latest"
args: ""
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Rust Nightly
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-06-25
- name: Install frontend dependencies
run: npm install
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
with:
releaseId: ${{ needs.create-release.outputs.release_id }}
args: ${{ matrix.args }}
- name: Install winget
if: matrix.platform == 'windows-latest'
uses: Cyberboss/install-winget@v1
- name: Install MSIX dependencies
if: matrix.platform == 'windows-latest'
shell: powershell
run: |
winget install --id Microsoft.DotNet.AspNetCore.8 --accept-package-agreements --accept-source-agreements --force
winget install --id Microsoft.DotNet.DesktopRuntime.8 --accept-package-agreements --accept-source-agreements --force
winget install --id MarcinOtorowski.MSIXHero --accept-package-agreements --accept-source-agreements --force
- name: Bundle MSIX
if: matrix.platform == 'windows-latest'
run: npx ts-node scripts/bundle.msix.ts
- name: Upload artifacts
id: artifact-upload-step
uses: actions/upload-artifact@v4
with:
name: build-bundle
path: target/release/bundle
- name: Output artifact ID
run: echo 'Artifact ID is ${{ steps.artifact-upload-step.outputs.artifact-id }}'
microsoft-store-submission:
needs: build-installers
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: build-bundle
path: target/release/bundle
# Use Store Broker to publish to Microsoft Store
- name: Submit to Partner Center (aka DevCenter)
shell: pwsh
run: |
./scripts/SubmitToStore.ps1
env:
PartnerCenterStoreId: ${{ secrets.MS_PRODUCT_ID }}
PartnerCenterTenantId: ${{ secrets.MS_TENANT_ID }}
PartnerCenterClientId: ${{ secrets.MS_CLIENT_ID }}
PartnerCenterClientSecret: ${{ secrets.MS_CLIENT_SECRET }}
SBDisableTelemetry: true
publish-release:
needs: [build-installers, create-release]
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Publish release
uses: actions/github-script@v7
env:
releaseId: ${{ needs.create-release.outputs.release_id }}
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
script: |
const result = await github.rest.repos.listReleaseAssets({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: process.env.releaseId,
});
result.data.forEach(async (asset) => {
if (asset.name.endsWith('.sig')) {
await github.rest.repos.deleteReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
asset_id: asset.id,
});
}
});
await github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: process.env.releaseId,
draft: false,
});
discord:
needs: publish-release
name: Send Announcement To Discord Server
runs-on: ubuntu-latest
steps:
- name: Discord notification
uses: LeGitHubDeTai/github-to-discord@main
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
DISCORD_USERNAME: Seelen
DISCORD_AVATAR: https://raw.githubusercontent.com/eythaann/Seelen-UI/master/documentation/images/logo_with_margins.png
AUTHOR_NAME: eythaann
AUTHOR_URL: "https://github.com/eythaann"
AUTHOR_AVATAR: "https://avatars.githubusercontent.com/u/76607907?v=4"
MESSAGE_TITLE: Seelen UI
MESSAGE_DESCRIPTION: A new release of Seelen UI has been published
MESSAGE_COLOR: 5814783
SECTION_NAME: "ChangeLog"
FOOTER_TEXT: "Seelen Inc."
FOOTER_URL: "https://github.com/eythaann/seelen-ui"