v2.4.0 CI fixes #336
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: ngx-ui-scroll ci | |
| on: | |
| push: | |
| branches: | |
| - "**" | |
| pull_request: | |
| branches: [ master ] | |
| workflow_dispatch: | |
| inputs: | |
| cause: | |
| description: 'Reason' | |
| required: true | |
| default: 'Manual triggering' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [14.x] | |
| steps: | |
| - name: Dispatched? | |
| if: ${{ github.event_name == 'workflow_dispatch' }} | |
| run: | | |
| echo "This is dispatched" | |
| echo "Build reason: ${{ github.event.inputs.cause }}" | |
| - name: Checkout | |
| uses: actions/checkout@v2 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v1 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - run: npm install | |
| - run: npm test | |
| - run: npm run build | |
| - run: npm run build-app | |
| - uses: actions/upload-artifact@master | |
| with: | |
| name: my-dist | |
| path: dist-app | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Set env BRANCH | |
| run: echo "BRANCH=$(echo $GITHUB_REF | cut -d'/' -f 3)" >> $GITHUB_ENV | |
| - name: Set env NEED | |
| run: | | |
| if [[ $BRANCH == 'master' && $GITHUB_EVENT_NAME == 'push' ]]; then | |
| echo "NEED=true" >> "$GITHUB_ENV" | |
| else | |
| echo "NEED=false" >> "$GITHUB_ENV" | |
| fi | |
| - name: Skip Deploy? | |
| if: env.NEED != 'true' | |
| run: echo "Only pushing to 'master' causes automatic deployment" | |
| - name: Checkout | |
| if: env.NEED == 'true' | |
| uses: actions/checkout@v2 | |
| - name: Download dist | |
| if: env.NEED == 'true' | |
| uses: actions/download-artifact@master | |
| with: | |
| name: my-dist | |
| path: dist-app | |
| - name: Deploy | |
| if: env.NEED == 'true' | |
| uses: JamesIves/github-pages-deploy-action@4.1.0 | |
| with: | |
| branch: gh-pages | |
| folder: dist-app |