Kaynağa Gözat

Re-enables insiders CI builds

Until the VS Code marketplace can truly handle pre-releases we can't adopt the current limited pre-release provided by VS Code
main
Eric Amodio 2 yıl önce
ebeveyn
işleme
f4973073e1
8 değiştirilmiş dosya ile 134 ekleme ve 15 silme
  1. +75
    -0
      .github/workflows/cd-insiders.yml
  2. +1
    -0
      .vscodeignore
  3. +5
    -1
      CONTRIBUTING.md
  4. +1
    -0
      README.insiders.md
  5. +4
    -1
      package.json
  6. +28
    -0
      scripts/applyInsidersPatch.js
  7. +16
    -11
      src/extension.ts
  8. +4
    -2
      src/messages.ts

+ 75
- 0
.github/workflows/cd-insiders.yml Dosyayı Görüntüle

@ -0,0 +1,75 @@
name: Publish Insiders
on:
schedule:
- cron: '0 9 * * *' # every day at 4am EST
workflow_dispatch:
jobs:
check:
name: Check for updates
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
status: ${{ steps.earlyexit.outputs.status }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- id: earlyexit
run: |
git config user.name github-actions
git config user.email github-actions@github.com
if git rev-parse origin/insiders >/dev/null 2>&1; then
insidersRef=$(git show-ref -s origin/insiders)
headRef=$(git show-ref --head -s head)
echo "origin/insiders"
echo $insidersRef
echo "HEAD"
echo $headRef
if [ "$insidersRef" = "$headRef" ]; then
echo "No changes since last insiders build. Exiting."
echo "::set-output name=status::unchanged"
exit 0
else
echo "Updating insiders"
git push origin --delete insiders
git checkout -b insiders
git push origin insiders
fi
else
echo "No insiders branch. Creating."
git checkout -b insiders
git push origin insiders
fi
echo "::set-output name=status::changed"
publish:
name: Publish insiders
needs: check
runs-on: ubuntu-latest
if: needs.check.outputs.status == 'changed'
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: '14'
- name: Install
run: yarn
- name: Apply insiders patch
run: yarn run patch-insiders
- name: Setup Environment
run: node -e "console.log('PACKAGE_VERSION=' + require('./package.json').version + '\nPACKAGE_NAME=' + require('./package.json').name + '-' + require('./package.json').version)" >> $GITHUB_ENV
- name: Package extension
run: yarn run package
- name: Publish extension
run: yarn vsce publish --yarn --packagePath ./${{ env.PACKAGE_NAME }}.vsix -p ${{ secrets.GITLENS_VSCODE_MARKETPLACE_PAT }}
- name: Publish artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.PACKAGE_NAME }}.vsix
path: ./${{ env.PACKAGE_NAME }}.vsix

+ 1
- 0
.vscodeignore Dosyayı Görüntüle

@ -35,6 +35,7 @@ BACKERS.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
esbuild.js
README.insiders.md
README.pre.md
svgo.config.js
tsconfig*.json

+ 5
- 1
CONTRIBUTING.md Dosyayı Görüntüle

@ -199,6 +199,10 @@ After the version commit and new tags are pushed to GitHub, the [Publish Stable
If the action fails, the VSIX will need to be built locally with `yarn package` and uploaded manually in the marketplace.
### Pre-release edition
### Pre-release edition (currently disabled until VS Code's marketplace supports pre-releases)
The [Publish Pre-release workflow](.github/workflows/cd-pre.yml) is automatically run every AM unless no new changes have been committed to `main`.
### Insiders edition
The [Publish Insiders workflow](.github/workflows/cd-insiders.yml) is automatically run every AM unless no new changes have been committed to `main`.

+ 1
- 0
README.insiders.md Dosyayı Görüntüle

@ -0,0 +1 @@
> **This is the insiders edition of GitLens for early feedback, and testing. It works best with [VS Code Insiders](https://code.visualstudio.com/insiders).**

+ 4
- 1
package.json Dosyayı Görüntüle

@ -3482,7 +3482,8 @@
"order": 70
},
"gitlens.insiders": {
"deprecationMessage": "Deprecated. Use the pre-release edition of GitLens instead"
"deprecationMessage": "Deprecated. Use the Insiders edition of GitLens instead",
"markdownDeprecationMessage": "Deprecated. Use the [Insiders edition](https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens-insiders) of GitLens instead"
}
}
}
@ -11636,7 +11637,9 @@
"lint": "eslint \"src/**/*.ts?(x)\" --fix",
"lint:webviews": "eslint \"src/webviews/apps/**/*.ts?(x)\" --fix",
"package": "vsce package --yarn",
"package-insiders": "yarn run patch-insiders && yarn run package",
"package-pre": "yarn run patch-pre && yarn run package --pre-release",
"patch-insiders": "node ./scripts/applyInsidersPatch.js",
"patch-pre": "node ./scripts/applyPreReleasePatch.js",
"pretty": "prettier --config .prettierrc --loglevel warn --write .",
"pub": "vsce publish --yarn",

+ 28
- 0
scripts/applyInsidersPatch.js Dosyayı Görüntüle

@ -0,0 +1,28 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const fs = require('fs');
// Patch README
const insert = fs.readFileSync('./README.insiders.md', { encoding: 'utf8' });
const data = fs.readFileSync('./README.md', { encoding: 'utf8' });
fs.writeFileSync('./README.md', `${insert}\n${data}`);
// Patch package.json
const date = new Date(new Date().toLocaleString('en-US', { timeZone: 'America/New_York' }));
let packageJSON = require('../package.json');
packageJSON = JSON.stringify(
{
...packageJSON,
name: `${packageJSON.name}-insiders`,
displayName: 'GitLens (Insiders)',
version: `${String(date.getFullYear())}.${date.getMonth() + 1}.${date.getDate()}${String(
date.getHours(),
).padStart(2, '0')}`,
preview: true,
},
undefined,
'\t',
);
packageJSON += '\n';
fs.writeFileSync('./package.json', packageJSON);

+ 16
- 11
src/extension.ts Dosyayı Görüntüle

@ -49,12 +49,15 @@ export async function activate(context: ExtensionContext): Promise
return undefined;
});
const sw = new Stopwatch(`GitLens${prerelease ? ' (pre-release)' : ''} v${gitlensVersion}`, {
log: {
message: ` activating in ${env.appName}(${codeVersion}) on the ${isWeb ? 'web' : 'desktop'}`,
//${context.extensionRuntime !== ExtensionRuntime.Node ? ' in a webworker' : ''}
const sw = new Stopwatch(
`GitLens${prerelease ? (insiders ? ' (Insiders)' : ' (pre-release)') : ''} v${gitlensVersion}`,
{
log: {
message: ` activating in ${env.appName}(${codeVersion}) on the ${isWeb ? 'web' : 'desktop'}`,
//${context.extensionRuntime !== ExtensionRuntime.Node ? ' in a webworker' : ''}
},
},
});
);
// If we are using the separate insiders extension, ensure that stable isn't also installed
if (insiders) {
@ -78,11 +81,13 @@ export async function activate(context: ExtensionContext): Promise
// If the build date is older than 14 days then show the expired error message
if (date.getTime() < Date.now() - 14 * 24 * 60 * 60 * 1000) {
sw.stop({
message: ` was NOT activated because this pre-release version (${gitlensVersion}) has expired`,
message: ` was NOT activated because this ${
insiders ? 'insiders' : 'pre-release'
} version (${gitlensVersion}) has expired`,
});
// If we don't use a setTimeout here this notification will get lost for some reason
setTimeout(() => void showPreReleaseExpiredErrorMessage(gitlensVersion), 0);
setTimeout(() => void showPreReleaseExpiredErrorMessage(gitlensVersion, insiders), 0);
return undefined;
}
@ -98,8 +103,8 @@ export async function activate(context: ExtensionContext): Promise
setKeysForSync(context);
const storage = new Storage(context);
const syncedVersion = storage.get(prerelease ? 'synced:preVersion' : 'synced:version');
const localVersion = storage.get(prerelease ? 'preVersion' : 'version');
const syncedVersion = storage.get(prerelease && !insiders ? 'synced:preVersion' : 'synced:version');
const localVersion = storage.get(prerelease && !insiders ? 'preVersion' : 'version');
let previousVersion: string | undefined;
if (localVersion == null || syncedVersion == null) {
@ -142,11 +147,11 @@ export async function activate(context: ExtensionContext): Promise
void showWelcomeOrWhatsNew(container, gitlensVersion, previousVersion);
void storage.store(prerelease ? 'preVersion' : 'version', gitlensVersion);
void storage.store(prerelease && !insiders ? 'preVersion' : 'version', gitlensVersion);
// Only update our synced version if the new version is greater
if (syncedVersion == null || compare(gitlensVersion, syncedVersion) === 1) {
void storage.store(prerelease ? 'synced:preVersion' : 'synced:version', gitlensVersion);
void storage.store(prerelease && !insiders ? 'synced:preVersion' : 'synced:version', gitlensVersion);
}
if (outputLevel === OutputLevel.Debug) {

+ 4
- 2
src/messages.ts Dosyayı Görüntüle

@ -111,10 +111,12 @@ export function showInsidersErrorMessage() {
);
}
export function showPreReleaseExpiredErrorMessage(version: string) {
export function showPreReleaseExpiredErrorMessage(version: string, insiders: boolean) {
return showMessage(
'error',
`This GitLens pre-release version (${version}) has expired. Please upgrade to a more recent version.`,
`This GitLens ${
insiders ? '(Insiders)' : 'pre-release'
} version (${version}) has expired. Please upgrade to a more recent version.`,
);
}

Yükleniyor…
İptal
Kaydet