Nightly #675
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Nightly | |
on: | |
workflow_dispatch: | |
inputs: | |
patchVersion: | |
description: "Format: YYYYMMDDHH" | |
schedule: | |
- cron: "0 0 * * *" # every day at midnight | |
jobs: | |
# from https://github.com/gitkraken/vscode-gitlens/blob/0fa0355132adb9c9e11ffe3f512c7d822fd2e67a/.github/workflows/cd-pre.yml#L9-L47 | |
# Updates the pre-release branch if there are changes since the last pre-release build and makes sure that when there are no changes, the workflow exits early | |
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@v4 | |
with: | |
fetch-depth: 0 | |
- id: earlyexit | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
if git rev-parse origin/pre >/dev/null 2>&1; then | |
preRef=$(git show-ref -s origin/pre) | |
headRef=$(git show-ref --head -s head) | |
echo "origin/pre" | |
echo $preRef | |
echo "HEAD" | |
echo $headRef | |
if [ "$preRef" = "$headRef" ]; then | |
echo "No changes since last pre-release build. Exiting." | |
echo "status=unchanged" >> $GITHUB_OUTPUT | |
exit 0 | |
else | |
echo "Updating pre" | |
git push origin --delete pre | |
git checkout -b pre | |
git push origin pre | |
fi | |
else | |
echo "No pre branch. Creating." | |
git checkout -b pre | |
git push origin pre | |
fi | |
echo "status=changed" >> $GITHUB_OUTPUT | |
nightly: | |
runs-on: ubuntu-latest | |
needs: check | |
if: needs.check.outputs.status == 'changed' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: | | |
yarn install --frozen-lockfile | |
- name: Update package.json | |
run: | | |
set -e | |
setSegmentKey="setpath([\"segmentKey\"]; \"untrusted-dummy-key\")" | |
setConfigcatKey="setpath([\"configcatKey\"]; \"gitpod\")" | |
jqCommands="${setSegmentKey} | ${setConfigcatKey}" | |
cat package.json | jq "${jqCommands}" > package.json.tmp | |
mv package.json.tmp package.json | |
- name: Generate package.json | |
run: | | |
set -e | |
node ./scripts/prepare-nightly-build.js -v ${{ github.event.inputs.patchVersion }} | |
mv package.insiders.json package.json | |
- name: Package extension | |
id: package_vsix | |
run: | | |
yarn package --pre-release | |
echo ::set-output name=vsix_path::$(ls *.vsix) | |
version=$(jq --raw-output '.version' package.json) | |
echo ::set-output name=version::$version | |
- name: Publish to MS Marketplace | |
run: | | |
npx vsce publish --packagePath ${{ steps.package_vsix.outputs.vsix_path }} | |
env: | |
VSCE_PAT: ${{ secrets.VSCE_PAT }} | |
# - name: Publish to Open VSX Registry | |
# run: | | |
# npx ovsx publish --packagePath ${{ steps.package_vsix.outputs.vsix_path }} | |
# env: | |
# OVSX_PAT: ${{ secrets.OPEN_VSX_PAT }} |