Browse Source

Adds CD insiders workflow

main
Eric Amodio 4 years ago
parent
commit
99daf8e7b6
3 changed files with 79 additions and 1 deletions
  1. +77
    -0
      .github/workflows/cd-insiders.yml
  2. +1
    -1
      .github/workflows/cd-stable.yml
  3. +1
    -0
      README.insiders.md

+ 77
- 0
.github/workflows/cd-insiders.yml View File

@ -0,0 +1,77 @@
name: Publish Insiders
on:
schedule:
- cron: '0 6 * * *' # every day at 6am
repository_dispatch:
types: [trigger-insiders-publish]
jobs:
check:
name: Check for updates
runs-on: ubuntu-latest
outputs:
status: ${{ steps.earlyexit.outputs.status }}
steps:
- name: Checkout code
uses: actions/checkout@v2
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@v2
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Install
run: yarn
- name: Patch README.md
run: node -e "var insert = fs.readFileSync('./README.insiders.md'); var d = fs.readFileSync('./README.md'); fs.writeFileSync('./README.md', insert + '\n' + d);"
- name: Patch package.json
run: |
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);"
- 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 pack
- name: Publish extension
run: yarn vsce publish --yarn --packagePath ./env.PACKAGENAME.vsixp{{ secrets.MARKETPLACE_PAT }}
- name: Publish artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.PACKAGE_NAME }}.vsix
path: ./${{ env.PACKAGE_NAME }}.vsix

+ 1
- 1
.github/workflows/cd-stable.yml View File

@ -25,7 +25,7 @@ jobs:
- name: Package extension
run: yarn run pack
# - name: Publish Extension
# run: npx vsce publish --packagePath ./env.PACKAGENAME.vsixp{{ secrets.MARKETPLACE_PAT }}
# run: yarn vsce publish --yarn --packagePath ./env.PACKAGENAME.vsixp{{ secrets.MARKETPLACE_PAT }}
- name: Generate Changelog
id: changelog
uses: mindsers/changelog-reader-action@v2

+ 1
- 0
README.insiders.md View File

@ -0,0 +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).**

||||||
x
 
000:0
Loading…
Cancel
Save