Skip to content

Commit 3429f4f

Browse files
Pre-release branch, pre (#64)
1 parent 65b857a commit 3429f4f

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/nightly.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,55 @@ on:
55
inputs:
66
patchVersion:
77
description: "Format: YYYYMMDDHH"
8+
schedule:
9+
- cron: "0 0 * * *" # every day at midnight
810

911
jobs:
12+
# from https://github.com/gitkraken/vscode-gitlens/blob/0fa0355132adb9c9e11ffe3f512c7d822fd2e67a/.github/workflows/cd-pre.yml#L9-L47
13+
# 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
14+
check:
15+
name: Check for updates
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: write
19+
outputs:
20+
status: ${{ steps.earlyexit.outputs.status }}
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v3
24+
with:
25+
fetch-depth: 0
26+
- id: earlyexit
27+
run: |
28+
git config user.name github-actions
29+
git config user.email [email protected]
30+
if git rev-parse origin/pre >/dev/null 2>&1; then
31+
preRef=$(git show-ref -s origin/pre)
32+
headRef=$(git show-ref --head -s head)
33+
echo "origin/pre"
34+
echo $preRef
35+
echo "HEAD"
36+
echo $headRef
37+
if [ "$preRef" = "$headRef" ]; then
38+
echo "No changes since last pre-release build. Exiting."
39+
echo "status=unchanged" >> $GITHUB_OUTPUT
40+
exit 0
41+
else
42+
echo "Updating pre"
43+
git push origin --delete pre
44+
git checkout -b pre
45+
git push origin pre
46+
fi
47+
else
48+
echo "No pre branch. Creating."
49+
git checkout -b pre
50+
git push origin pre
51+
fi
52+
echo "status=changed" >> $GITHUB_OUTPUT
1053
nightly:
1154
runs-on: ubuntu-latest
55+
needs: check
56+
if: needs.check.outputs.status == 'changed'
1257
steps:
1358
- uses: actions/checkout@v3
1459
- uses: actions/setup-node@v3

0 commit comments

Comments
 (0)