trigger-ci-workflow #1521
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: CI | |
on: | |
push: | |
repository_dispatch: | |
types: [trigger-ci-workflow] | |
env: | |
FORCE_COLOR: true | |
jobs: | |
build: | |
name: Build SPA | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18] | |
steps: | |
- name: Print GitHub event action | |
run: echo "${{ github.event.action }}" | |
- uses: actions/checkout@v3 | |
if: ${{ github.event.action != 'repository_dispatch' }} | |
- uses: actions/checkout@v3 | |
if: ${{ github.event.action == 'repository_dispatch' }} | |
with: | |
ref: ${{ github.event.client_payload.sha }} | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Get Yarn Cache Directory | |
id: yarn-cache-dir-path | |
run: echo '::set-output name=dir::$(yarn cache dir)' | |
- name: Use Yarn Cache | |
uses: actions/cache@v3 | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} | |
- name: Install Dependencies | |
run: yarn install --prefer-offline --frozen-lockfile | |
- name: Build SPA | |
run: yarn build:ci | |
- name: Deploy SPA | |
if: success() && ${{ github.ref == 'refs/heads/master' }} | |
uses: wopian/netlify-actions-colors-fix/cli@b336c456c5b67c3f95e06fc1221725a657d896d6 | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
with: | |
args: deploy --dir=dist --prod --message='Deployed ${{ github.sha }} via GitHub Actions' |