forked from podman-desktop/podman-desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
222 lines (193 loc) · 8.5 KB
/
next-build.yaml
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
#
# Copyright (C) 2022-2024 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
name: next build
on:
workflow_dispatch:
push:
branches:
- main
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
DEBUG: electron-builder
jobs:
tag:
name: Tagging
runs-on: ubuntu-22.04
outputs:
githubTag: ${{ steps.TAG_UTIL.outputs.githubTag}}
desktopVersion: ${{ steps.TAG_UTIL.outputs.desktopVersion}}
releaseId: ${{ steps.create_release.outputs.id}}
steps:
- uses: actions/checkout@v4
- name: Generate tag utilities
id: TAG_UTIL
run: |
CURRENT_DAY=$(date +'%Y%m%d')
SHORT_SHA1=$(git rev-parse --short HEAD)
TAG_PATTERN=0.0.$(date +'%Y%m%d%H%M')-${SHORT_SHA1}
echo "githubTag=v$TAG_PATTERN" >> ${GITHUB_OUTPUT}
echo "desktopVersion=$TAG_PATTERN" >> ${GITHUB_OUTPUT}
- name: tag
run: |
git config --local user.name ${{ github.actor }}
sed -i "s#version\":\ \"\(.*\)\",#version\":\ \"${{ steps.TAG_UTIL.outputs.desktopVersion }}\",#g" package.json
find extensions/* -maxdepth 2 -name "package.json" | xargs -I {} sed -i "s#version\":\ \"\(.*\)\",#version\":\ \"${{ steps.TAG_UTIL.outputs.desktopVersion }}\",#g" {}
cat package.json
git add package.json extensions/*/package.json
git commit -m "chore: tag ${{ steps.TAG_UTIL.outputs.githubTag }}"
echo "Tagging with ${{ steps.TAG_UTIL.outputs.githubTag }}"
git tag ${{ steps.TAG_UTIL.outputs.githubTag }}
git push origin ${{ steps.TAG_UTIL.outputs.githubTag }}
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: ${{ steps.TAG_UTIL.outputs.githubTag }}
name: ${{ steps.TAG_UTIL.outputs.githubTag }}
draft: true
prerelease: true
build:
name: Build / ${{ matrix.os }}
needs: tag
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-2022, ubuntu-22.04, macos-14]
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.tag.outputs.githubTag}}
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Get yarn cache directory path (Windows)
if: ${{ matrix.os=='windows-2022' }}
id: yarn-cache-dir-path-windows
run: echo "dir=$(yarn cache dir)" >> ${env:GITHUB_OUTPUT}
- name: Get yarn cache directory path (mac/Linux)
if: ${{ matrix.os=='ubuntu-22.04' || matrix.os=='macos-14' }}
id: yarn-cache-dir-path-unix
run: echo "dir=$(yarn cache dir)" >> ${GITHUB_OUTPUT}
- uses: actions/cache@v4
if: ${{ matrix.os=='windows-2022' }}
id: yarn-cache-windows
with:
path: ${{ steps.yarn-cache-dir-path-windows.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- uses: actions/cache@v4
if: ${{ matrix.os=='ubuntu-22.04' || matrix.os=='macos-14' }}
id: yarn-cache-unix
with:
path: ${{ steps.yarn-cache-dir-path-unix.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: setup telemetry key for production
run: |
sed -i -r -e "s/SEGMENT_KEY = '.*'/SEGMENT_KEY = '${{ secrets.SEGMENT_WRITE_KEY }}'/" packages/main/src/plugin/telemetry/telemetry.ts
- name: yarn
run: |
yarn --frozen-lockfile --network-timeout 180000
- name: Install flatpak on Linux
if: ${{ matrix.os=='ubuntu-22.04' }}
run: |
sudo apt-get update
sudo apt-get install flatpak -y
sudo apt-get install flatpak-builder -y
sudo apt-get install elfutils -y
flatpak remote-add --if-not-exists flathub --user https://flathub.org/repo/flathub.flatpakrepo
flatpak install flathub --user -y org.freedesktop.Platform//23.08 org.freedesktop.Sdk//23.08
- name: Set macOS environment variables
if: startsWith(matrix.os, 'macos')
run: |
echo "CSC_LINK=${{secrets.CSC_LINK}}" >> $GITHUB_ENV
echo "CSC_KEY_PASSWORD=${{secrets.CSC_KEY_PASSWORD}}" >> $GITHUB_ENV
echo "APPLE_ID=${{secrets.APPLE_ID}}" >> $GITHUB_ENV
echo "APPLE_ID_PASSWORD=${{secrets.APPLE_ID_PASSWORD}}" >> $GITHUB_ENV
echo "APPLE_TEAM_ID=${{secrets.APPLE_TEAM_ID}}" >> $GITHUB_ENV
- name: Install Azure SignTool on Windows
if: startsWith(matrix.os, 'windows')
run: |
dotnet tool install --global AzureSignTool --version 3.0.0
echo "AZURE_KEY_VAULT_CERTIFICATE=${{secrets.AZURE_KEY_VAULT_CERTIFICATE}}" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "AZURE_KEY_VAULT_CLIENT_ID=${{secrets.AZURE_KEY_VAULT_CLIENT_ID}}" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "AZURE_KEY_VAULT_SECRET=${{secrets.AZURE_KEY_VAULT_SECRET}}" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "AZURE_KEY_VAULT_TENANT_ID=${{secrets.AZURE_KEY_VAULT_TENANT_ID}}" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "AZURE_KEY_VAULT_URL=${{secrets.AZURE_KEY_VAULT_URL}}" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Run Build
timeout-minutes: 40
run: yarn compile:next
release:
needs: [tag, build]
name: Release
runs-on: ubuntu-22.04
steps:
- name: id
run: echo the release id is ${{ needs.tag.outputs.releaseId}}
- name: Publish release
uses: StuYarrow/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
id: ${{ needs.tag.outputs.releaseId}}
publish:
needs: [tag, release]
name: Publish
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> ${GITHUB_OUTPUT}
- uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Execute yarn
run: yarn --frozen-lockfile --network-timeout 180000
- name: Set-up npmjs auth token
run: printf "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}\n" >> ~/.npmrc
- name: Publish API to npmjs
run: |
echo "Using version ${{ needs.tag.outputs.desktopVersion }}"
sed -i "s#version\":\ \"\(.*\)\",#version\":\ \"${{ needs.tag.outputs.desktopVersion }}\",#g" packages/extension-api/package.json
cd packages/extension-api && yarn publish --tag next --no-git-tag-version --new-version "${{ needs.tag.outputs.desktopVersion }}" --access public
- name: Publish ui/svelte to npmjs
run: |
echo "Using version ${{ needs.tag.outputs.desktopVersion }}"
sed -i "s#version\":\ \"\(.*\)\",#version\":\ \"${{ needs.tag.outputs.desktopVersion }}\",#g" packages/ui/package.json
cd packages/ui && yarn build && yarn publish --tag next --no-git-tag-version --new-version "${{ needs.tag.outputs.desktopVersion }}" --access public
- name: Publish tests-playwright to npmjs
run: |
echo "Using version ${{ needs.tag.outputs.desktopVersion }}"
sed -i "s#version\":\ \"\(.*\)\",#version\":\ \"${{ needs.tag.outputs.desktopVersion }}\",#g" tests/playwright/package.json
cd tests/playwright && yarn build && yarn publish --tag next --no-git-tag-version --new-version "${{ needs.tag.outputs.desktopVersion }}" --access public