Skip to content

Commit ea0099c

Browse files
committed
Add nightly github action
1 parent 64713ae commit ea0099c

File tree

7 files changed

+102
-8
lines changed

7 files changed

+102
-8
lines changed

.github/workflows/nightly.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Nightly
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
patchVersion:
7+
description: "Format: YYYYMMDDHH"
8+
9+
jobs:
10+
nightly:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-node@v3
15+
with:
16+
node-version: 16
17+
18+
- name: Install dependencies
19+
run: |
20+
yarn install --frozen-lockfile
21+
22+
- name: Update package.json
23+
run: |
24+
set -e
25+
setSegmentKey="setpath([\"segmentKey\"]; \"${{ secrets.ANALITYCS_KEY }}\")"
26+
jqCommands="${setSegmentKey}"
27+
cat package.json | jq "${jqCommands}" > package.json.tmp
28+
mv package.json.tmp package.json
29+
30+
- name: Generate package.json
31+
run: |
32+
node ./scripts/prepare-nightly-build.js -v ${{ github.event.inputs.patchVersion }}
33+
34+
- name: Override package.json
35+
run: |
36+
mv ./package.json ./package.json.bak
37+
mv ./package.insiders.json ./package.json
38+
39+
- name: Package extension
40+
id: package_vsix
41+
run: |
42+
yarn package --pre-release
43+
echo ::set-output name=vsix_path::$(ls *.vsix)
44+
45+
version=$(jq --raw-output '.version' package.json)
46+
echo ::set-output name=version::$version
47+
48+
- name: Publish to MS Marketplace
49+
run: |
50+
npx vsce publish --packagePath ${{ steps.package_vsix.outputs.vsix_path }}
51+
env:
52+
VSCE_PAT: ${{ secrets.VSCE_PAT }}
53+
54+
# - name: Publish to Open VSX Registry
55+
# run: |
56+
# npx ovsx publish --packagePath ${{ steps.package_vsix.outputs.vsix_path }}
57+
# env:
58+
# OVSX_PAT: ${{ secrets.OPEN_VSX_PAT }}

.github/workflows/release.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: Release
22

33
on:
44
workflow_dispatch:
5-
inputs:
65

76
jobs:
87
release:
@@ -13,15 +12,18 @@ jobs:
1312
with:
1413
node-version: 16
1514

16-
- run: |
15+
- name: Install dependencies
16+
run: |
17+
yarn install --frozen-lockfile
18+
19+
- name: Update package.json
20+
run: |
1721
set -e
1822
setSegmentKey="setpath([\"segmentKey\"]; \"${{ secrets.ANALITYCS_KEY }}\")"
1923
jqCommands="${setSegmentKey}"
2024
cat package.json | jq "${jqCommands}" > package.json.tmp
2125
mv package.json.tmp package.json
2226
23-
yarn install --frozen-lockfile
24-
2527
- name: Package extension
2628
id: package_vsix
2729
run: |

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ out/
33
.vscode-test/
44
*.vsix
55
.DS_Store
6+
package.insiders.json

.vscodeignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ yarn.lock
1010
.eslintrc.json
1111
.gitpod.yml
1212
webpack.config.js
13+
package.insiders.json

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"publisher": "gitpod",
66
"version": "0.0.37",
77
"license": "MIT",
8-
"preview": true,
98
"icon": "resources/gitpod.png",
109
"repository": {
1110
"type": "git",
@@ -15,7 +14,7 @@
1514
"url": "https://github.com/gitpod-io/gitpod/issues"
1615
},
1716
"engines": {
18-
"vscode": "^1.58.2"
17+
"vscode": "^1.63.0"
1918
},
2019
"categories": [
2120
"Other"
@@ -109,7 +108,7 @@
109108
"@types/ssh2": "^0.5.52",
110109
"@types/tmp": "^0.2.1",
111110
"@types/uuid": "8.0.0",
112-
"@types/vscode": "^1.58.2",
111+
"@types/vscode": "^1.63.0",
113112
"@types/webpack": "^5.28.0",
114113
"@types/ws": "^7.4.7",
115114
"@types/yazl": "^2.4.2",

scripts/prepare-nightly-build.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
const fs = require('fs');
2+
const argv = require('minimist')(process.argv.slice(2));
3+
4+
const json = JSON.parse(fs.readFileSync('./package.json').toString());
5+
const stableVersion = json.version.match(/(\d+)\.(\d+)\.(\d+)/);
6+
const major = stableVersion[1];
7+
const minor = stableVersion[2];
8+
9+
function prependZero(number) {
10+
if (number > 99) {
11+
throw 'Unexpected value to prepend with zero';
12+
}
13+
return `${number < 10 ? '0' : ''}${number}`;
14+
}
15+
16+
// update name, publisher and description
17+
// calculate version
18+
let patch = argv['v'];
19+
if (typeof patch !== 'number') {
20+
const date = new Date();
21+
const month = date.getUTCMonth() + 1;
22+
const day = date.getUTCDate();
23+
const hours = date.getUTCHours();
24+
patch = `${date.getUTCFullYear()}${prependZero(month)}${prependZero(day)}${prependZero(hours)}`;
25+
}
26+
27+
// The stable version should always be <major>.<minor_even_number>.patch
28+
// For the nightly build, we keep the major, make the minor an odd number with +1, and add the timestamp as a patch.
29+
const insiderPackageJson = Object.assign(json, {
30+
version: `${major}.${Number(minor) + 1}.${patch}`
31+
});
32+
33+
fs.writeFileSync('./package.insiders.json', JSON.stringify(insiderPackageJson, undefined, '\t'));

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@
237237
resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-8.0.0.tgz#165aae4819ad2174a17476dbe66feebd549556c0"
238238
integrity sha512-xSQfNcvOiE5f9dyd4Kzxbof1aTrLobL278pGLKOZI6esGfZ7ts9Ka16CzIN6Y8hFHE1C7jIBZokULhK1bOgjRw==
239239

240-
"@types/vscode@^1.58.2":
240+
"@types/vscode@^1.63.0":
241241
version "1.67.0"
242242
resolved "https://registry.yarnpkg.com/@types/vscode/-/vscode-1.67.0.tgz#8eaba41d1591aa02f5d960b7dfae3b16e066f08c"
243243
integrity sha512-GH8BDf8cw9AC9080uneJfulhSa7KHSMI2s/CyKePXoGNos9J486w2V4YKoeNUqIEkW4hKoEAWp6/cXTwyGj47g==

0 commit comments

Comments
 (0)