-
Notifications
You must be signed in to change notification settings - Fork 70
226 lines (200 loc) · 9.05 KB
/
release-gp.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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
name: Release Gitpod Code
on:
workflow_dispatch:
inputs:
commit:
description: 'Commit to release'
required: true
quality:
description: 'Quality'
required: true
type: choice
options:
- insider
- stable
default: insider
addTags:
description: 'Adds release tags (latest, nightly, etc) to the image'
type: boolean
required: true
# workflow_run:
# workflows: ["Gitpod Code Rebase"]
# types: [completed]
env:
QUALITY: ${{ github.event.inputs.quality || 'insider' }}
RELEASE_COMMIT: ${{ github.event.inputs.commit || 'gp-code/main' }}
ADD_TAGS: ${{ github.event.inputs.addTags || 'true' }}
jobs:
build:
runs-on: ubuntu-latest
name: Build linux-x64
env:
OS_NAME: 'linux'
VSCODE_ARCH: 'x64'
NPM_REGISTRY: 'https://registry.yarnpkg.com'
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/openvscode-server
ref: ${{ env.RELEASE_COMMIT }}
path: openvscode-server
token: ${{ secrets.VSCODE_GITHUB_TOKEN }}
- name: Auth Google Cloud SDK
uses: google-github-actions/auth@v0
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name: Set up Google Cloud SDK
uses: google-github-actions/setup-gcloud@v0
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
- name: Set up Docker
run: |
gcloud auth configure-docker --quiet
- uses: actions/setup-node@v3
with:
node-version: 20
- name: Install Yarn
run: npm install -g yarn
- name: Compute node modules cache key
working-directory: ./openvscode-server
id: nodeModulesCacheKey
run: echo "value=$(node build/azure-pipelines/common/computeNodeModulesCacheKey.js x64)" >> $GITHUB_OUTPUT
- name: Cache node modules
id: cacheNodeModules
uses: actions/cache@v3
with:
path: "openvscode-server/**/node_modules"
key: ${{ runner.os }}-cacheNodeModulesLinux-${{ steps.nodeModulesCacheKey.outputs.value }}
- name: Get yarn cache directory path
working-directory: ./openvscode-server
id: yarnCacheDirPath
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Cache yarn directory
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
uses: actions/cache@v3
with:
path: ${{ steps.yarnCacheDirPath.outputs.dir }}
key: ${{ runner.os }}-yarnCacheDir-${{ steps.nodeModulesCacheKey.outputs.value }}
restore-keys: ${{ runner.os }}-yarnCacheDir-
- name: Execute yarn
working-directory: ./openvscode-server
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
VSCODE_SKIP_NODE_VERSION_CHECK: 1
npm_config_arch: x64
VSCODE_REMOTE_DEPENDENCIES_CONTAINER_NAME: gitpod/openvscode-server-linux-build-agent:centos7-devtoolset8-x64
VSCODE_HOST_MOUNT: ${{ github.workspace }}/openvscode-server
run: |
set -e
yarn --cwd build --frozen-lockfile --check-files
docker run -e npm_config_arch -e NPM_REGISTRY \
-e VSCODE_REMOTE_DEPENDENCIES_CONTAINER_NAME -e VSCODE_HOST_MOUNT \
-e ELECTRON_SKIP_BINARY_DOWNLOAD -e PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD \
-e VSCODE_SKIP_NODE_VERSION_CHECK \
-v $GITHUB_WORKSPACE/openvscode-server:/home/builduser/openvscode-server \
-v /var/run/docker.sock:/var/run/docker.sock \
-u 1001:121 \
-w /home/builduser/openvscode-server gitpod/openvscode-server-linux-build-agent:bionic-$VSCODE_ARCH \
/bin/bash -c "./build/azure-pipelines/linux/install.sh"
sudo chown -R $USER:$USER $GITHUB_WORKSPACE/openvscode-server
- name: Update product.json
working-directory: ./openvscode-server
run: |
set -e
nameShort=$(jq --raw-output '.nameShort' product.json)
nameLong=$(jq --raw-output '.nameLong' product.json)
if [ "$QUALITY" = "insider" ]; then
nameShort="$nameShort - Insiders"
nameLong="$nameLong - Insiders"
fi
setQuality="setpath([\"quality\"]; \"$QUALITY\")"
setNameShort="setpath([\"nameShort\"]; \"$nameShort\")"
setNameLong="setpath([\"nameLong\"]; \"$nameLong\")"
setExtensionsGalleryItemUrl="setpath([\"extensionsGallery\", \"itemUrl\"]; \"{{extensionsGalleryItemUrl}}\")"
addTrustedDomain=".linkProtectionTrustedDomains += [\"{{trustedDomain}}\"]"
jqCommands="${setQuality} | ${setNameShort} | ${setNameLong} | ${setExtensionsGalleryItemUrl} | ${addTrustedDomain}"
cat product.json | jq "${jqCommands}" > product.json.tmp
mv product.json.tmp product.json
jq '{quality,nameLong,nameShort}' product.json
- name: Prepare for distribution
working-directory: ./openvscode-server
run: |
set -e
yarn gulp compile-build
yarn gulp extensions-ci
yarn gulp minify-vscode-reh
yarn gulp vscode-web-min-ci
yarn gulp vscode-reh-linux-x64-min-ci
env:
DISABLE_V8_COMPILE_CACHE: 1
- name: Custom Gitpod stuff
run: |
set -e
# config for first layer needed by blobserve
# this custom urls will be then replaced by blobserve.
# Check pkg/blobserve/blobserve.go, `inlineVars` method
cp vscode-web/out/vs/gitpod/browser/workbench/workbench.html vscode-web/index.html
cp vscode-web/out/vs/gitpod/browser/workbench/callback.html vscode-web/callback.html
sed -i -e 's#baseUrl =.*;#baseUrl = window.location.origin;#g' vscode-web/index.html
sed -i -e 's#{{WORKBENCH_WEB_BASE_URL}}#.#g' vscode-web/index.html
sed -i -e "s/{{VERSION}}/$CODE_QUALITY-$CODE_COMMIT/g" vscode-web/index.html
# cli config: alises to gitpod-code
cp vscode-reh-linux-x64/bin/remote-cli/gitpod-code vscode-reh-linux-x64/bin/remote-cli/code
cp vscode-reh-linux-x64/bin/remote-cli/gitpod-code vscode-reh-linux-x64/bin/remote-cli/gp-code
cp vscode-reh-linux-x64/bin/remote-cli/gitpod-code vscode-reh-linux-x64/bin/remote-cli/open
# grant write permissions for built-in extensions
chmod -R ugo+w vscode-reh-linux-x64/extensions
- name: Store release data
id: release_data
run: |
set -e
version=$(node -p -e "require('./openvscode-server/package.json').version")
release_commit=$(git -C openvscode-server rev-parse "${RELEASE_COMMIT}")
echo "release_commit=${release_commit}" >> $GITHUB_OUTPUT
echo "version=${version}" >> $GITHUB_OUTPUT
echo "quality=${QUALITY}" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
eu.gcr.io/gitpod-core-dev/build/ide/code
tags: |
type=raw,value=commit-${{ steps.release_data.outputs.release_commit }}
type=raw,value=${{ steps.release_data.outputs.version }},enable=${{ steps.release_data.outputs.quality == 'stable' && env.ADD_TAGS == 'true'}}
type=raw,value=latest,enable=${{ steps.release_data.outputs.quality == 'stable' && env.ADD_TAGS == 'true' }}
type=raw,value=insiders,enable=${{ steps.release_data.outputs.quality != 'stable' && env.ADD_TAGS == 'true' }}
type=raw,value=nightly,enable=${{ steps.release_data.outputs.quality != 'stable' && env.ADD_TAGS == 'true' }}
- name: Docker build and push
uses: docker/build-push-action@v3
with:
push: true
context: .
file: ./gitpodCode.Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: |
io.gitpod.ide.version=${{ steps.release_data.outputs.version }}
io.gitpod.ide.commit=${{ steps.release_data.outputs.release_commit }}
- name: Output the image tag to the GitHub Summary
run: |
echo "Successfully built the \`Gitpod Code\` with the tag:" >> summary.md
echo "" >> summary.md
echo "\`\`\`" >> summary.md
echo "commit-${{ steps.release_data.outputs.release_commit }}" >> summary.md
echo "\`\`\`" >> summary.md
cat summary.md >> $GITHUB_STEP_SUMMARY
- name: Get previous job's status
id: lastrun
uses: filiptronicek/get-last-job-status@main
- name: Slack Notification
if: ${{ (success() && steps.lastrun.outputs.status == 'failed') || failure() }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_COLOR: ${{ job.status }}