v3.2.1 #311
This file contains 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: | |
pull_request: | |
push: | |
branches: | |
- 'master' | |
workflow_dispatch: | |
inputs: | |
cause: | |
description: 'Reason' | |
required: true | |
default: 'Manual triggering' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16.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@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- run: npm run ci:lib | |
- run: npm run build:lib | |
- run: npm run ci:demo | |
- run: npm run build:demo | |
- run: npm run ci:tests | |
- run: npm test | |
- uses: actions/upload-artifact@master | |
with: | |
name: demo-dist | |
path: dist/demo | |
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@v3 | |
- name: Download dist | |
if: env.NEED == 'true' | |
uses: actions/download-artifact@master | |
with: | |
name: demo-dist | |
path: dist-demo-app | |
- name: Deploy | |
if: env.NEED == 'true' | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
branch: gh-pages | |
folder: dist-demo-app |