Skip to content

Commit 99daf8e

Browse files
committed
Adds CD insiders workflow
1 parent e7beedb commit 99daf8e

File tree

3 files changed

+79
-1
lines changed

3 files changed

+79
-1
lines changed

.github/workflows/cd-insiders.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Publish Insiders
2+
3+
on:
4+
schedule:
5+
- cron: '0 6 * * *' # every day at 6am
6+
repository_dispatch:
7+
types: [trigger-insiders-publish]
8+
9+
jobs:
10+
check:
11+
name: Check for updates
12+
runs-on: ubuntu-latest
13+
outputs:
14+
status: ${{ steps.earlyexit.outputs.status }}
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
- id: earlyexit
21+
run: |
22+
git config user.name github-actions
23+
git config user.email [email protected]
24+
if git rev-parse origin/insiders >/dev/null 2>&1; then
25+
insidersRef=$(git show-ref -s origin/insiders)
26+
headRef=$(git show-ref --head -s head)
27+
echo "origin/insiders"
28+
echo $insidersRef
29+
echo "HEAD"
30+
echo $headRef
31+
if [ "$insidersRef" = "$headRef" ]; then
32+
echo "No changes since last insiders build. Exiting."
33+
echo "::set-output name=status::unchanged"
34+
exit 0
35+
else
36+
echo "Updating insiders"
37+
git push origin --delete insiders
38+
git checkout -b insiders
39+
git push origin insiders
40+
fi
41+
else
42+
echo "No insiders branch. Creating."
43+
git checkout -b insiders
44+
git push origin insiders
45+
fi
46+
echo "::set-output name=status::changed"
47+
48+
publish:
49+
name: Publish insiders
50+
needs: check
51+
runs-on: ubuntu-latest
52+
if: needs.check.outputs.status == 'changed'
53+
steps:
54+
- name: Checkout code
55+
uses: actions/checkout@v2
56+
- name: Setup node
57+
uses: actions/setup-node@v1
58+
with:
59+
node-version: '12.x'
60+
- name: Install
61+
run: yarn
62+
- name: Patch README.md
63+
run: node -e "var insert = fs.readFileSync('./README.insiders.md'); var d = fs.readFileSync('./README.md'); fs.writeFileSync('./README.md', insert + '\n' + d);"
64+
- name: Patch package.json
65+
run: |
66+
node -e "var d = new Date(new Date().toLocaleString('en-US', { timeZone: 'America/New_York' })); var p = require('./package.json'); p = JSON.stringify({...p, name: p.name + '-insiders', displayName: p.displayName + ' (Insiders)', version: '' + d.getFullYear() + '.' + (d.getMonth() + 1) + '.' + d.getDate() + String(d.getHours()).padStart(2, '0') }); fs.writeFileSync('./package.json', p);"
67+
- name: Setup Environment
68+
run: node -e "console.log('PACKAGE_VERSION=' + require('./package.json').version + '\nPACKAGE_NAME=' + require('./package.json').name + '-' + require('./package.json').version)" >> $GITHUB_ENV
69+
- name: Package extension
70+
run: yarn run pack
71+
- name: Publish extension
72+
run: yarn vsce publish --yarn --packagePath ./${{ env.PACKAGE_NAME }}.vsix -p ${{ secrets.MARKETPLACE_PAT }}
73+
- name: Publish artifact
74+
uses: actions/upload-artifact@v2
75+
with:
76+
name: ${{ env.PACKAGE_NAME }}.vsix
77+
path: ./${{ env.PACKAGE_NAME }}.vsix

.github/workflows/cd-stable.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Package extension
2626
run: yarn run pack
2727
# - name: Publish Extension
28-
# run: npx vsce publish --packagePath ./${{ env.PACKAGE_NAME }}.vsix -p ${{ secrets.MARKETPLACE_PAT }}
28+
# run: yarn vsce publish --yarn --packagePath ./${{ env.PACKAGE_NAME }}.vsix -p ${{ secrets.MARKETPLACE_PAT }}
2929
- name: Generate Changelog
3030
id: changelog
3131
uses: mindsers/changelog-reader-action@v2

README.insiders.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
> **This is the insiders version of GitLens for early feedback and testing. It works best with [VS Code Insiders](https://code.visualstudio.com/insiders).**

0 commit comments

Comments
 (0)