|
|
- name: Publish pre-release
-
- 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 pre-release
- 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 pre-release patch
- run: yarn run patch-pre
- - 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 --pre-release
- - name: Publish extension
- run: yarn vsce publish --yarn --pre-release --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
|