From a91791e7c811fe48f08bb88f39dde199f09a94d8 Mon Sep 17 00:00:00 2001 From: Yishuai Li Date: Wed, 2 Mar 2022 17:39:55 -0500 Subject: [PATCH] ci: deploy upon token exists --- .github/workflows/deploy.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5641744..2a08858 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -23,12 +23,30 @@ jobs: npm run test npm run build - name: Publish + if: needs.check-env.outputs.check-npm == 'true' uses: JS-DevTools/npm-publish@v1 with: token: ${{ secrets.NPM_TOKEN }} - name: Deploy to gh-pages + if: needs.check-env.outputs.check-access == 'true' uses: JamesIves/github-pages-deploy-action@releases/v3 with: ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} BRANCH: gh-pages FOLDER: _site + check-env: + runs-on: ubuntu-latest + outputs: + check-npm: ${{ steps.check-npm.outputs.defined }} + check-access: ${{ steps.check-access.outputs.defined }} + step: + - id: check-npm + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + if: ${{ env.NPM_TOKEN != '' }} + run: echo "::set-output name=defined::true" + - id: check-access + env: + ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} + if: ${{ env.ACCESS_TOKEN != '' }} + run: echo "::set-output name=defined::true"