release(18.3.0): release 18.3.0 #351
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 | |
on: | |
pull_request: | |
push: | |
branches: [main, master] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'yarn' | |
- name: Comment on github | |
run: node ./scripts/github/comment.js "[Preview Preparing...](https://github.com/ng-alain/delon/actions/runs/${{ github.run_id }})" | |
if: github.event.number | |
env: | |
ACCESS_REPO: ${{ github.repository }} | |
ACCESS_TOKEN: ${{ secrets.CI_TOKEN }} | |
PR_NUMBER: ${{ github.event.number }} | |
- uses: actions/cache@v3 | |
with: | |
path: ./node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock', '**/*.patch') }} | |
- name: Install node modules | |
run: yarn install --frozen-lockfile | |
- name: Build artifacts | |
run: ./scripts/ci/build-artifacts.sh | |
env: | |
ACCESS_TOKEN: ${{ secrets.CI_TOKEN }} | |
MESSAGE: ${{ github.event.pull_request.title || github.event.head_commit.message }} | |
- name: Build site | |
run: yarn run site:build | |
- name: 'Deploy Site' | |
if: github.event.number | |
run: | | |
export DEPLOY_DOMAIN=https://preview-${{ github.event.number }}-ng-alain-delon.surge.sh | |
echo "Deploy to $DEPLOY_DOMAIN" | |
cp ./src/dist/browser/index.html ./src/dist/browser/404.html | |
npx surge --project ./src/dist/browser --domain $DEPLOY_DOMAIN | |
env: | |
ACCESS_REPO: ${{ github.repository }} | |
ACCESS_TOKEN: ${{ secrets.CI_TOKEN }} | |
SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }} | |
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} | |
- name: 'Update comment on github' | |
if: github.event.number | |
run: | | |
export DEPLOY_DOMAIN=https://preview-${{ github.event.number }}-ng-alain-delon.surge.sh | |
node ./scripts/github/comment.js "[Preview is ready!]($DEPLOY_DOMAIN)" | |
env: | |
ACCESS_REPO: ${{ github.repository }} | |
ACCESS_TOKEN: ${{ secrets.CI_TOKEN }} | |
PR_NUMBER: ${{ github.event.number }} | |
- name: 'When failed' | |
if: github.event.number && failure() | |
run: node ./scripts/github/comment.js "[Preview Build Failed!](https://github.com/ng-alain/delon/actions/runs/${{ github.run_id }})" | |
env: | |
ACCESS_REPO: ${{ github.repository }} | |
ACCESS_TOKEN: ${{ secrets.CI_TOKEN }} | |
PR_NUMBER: ${{ github.event.number }} | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'yarn' | |
- uses: actions/cache@v3 | |
with: | |
path: ./node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock', '**/*.patch') }} | |
- name: Install node modules | |
run: yarn install --frozen-lockfile | |
- name: Test | |
run: yarn run test | |
- uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
directory: ./coverage/ | |
files: cobertura-coverage.xml | |
fail_ci_if_error: true | |
verbose: true | |
test-cli: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'yarn' | |
- uses: actions/cache@v3 | |
with: | |
path: ./node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock', '**/*.patch') }} | |
- name: Install node modules | |
run: yarn install --frozen-lockfile | |
- name: Test | |
run: yarn run test:cli | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'yarn' | |
- uses: actions/cache@v3 | |
with: | |
path: ./node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock', '**/*.patch') }} | |
- name: Install node modules | |
run: yarn install --frozen-lockfile | |
- name: Check code lint | |
run: yarn run lint |