fix: yarn.lock #430
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: Publish NPM Package | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the master branch | |
on: | |
push: | |
branches: | |
- master | |
# schedule: | |
# # every monday | |
# # more: https://crontab.guru/examples.html | |
# - cron: '0 1 * * 1' | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
on-success: | |
needs: publish | |
runs-on: ubuntu-latest | |
container: whatwewant/zmicro:v1.16.5 | |
if: ${{ always() && needs.publish.result == 'success' }} | |
steps: | |
- name: Notification Feishu | |
uses: whatwewant/[email protected] | |
with: | |
url: ${{ secrets.NPM_VERSION_FEISHU_BOT_WEBHOOK_URL }} | |
title: '✅ NPM 发布:${{ github.repository }}' | |
text: | | |
分支: ${{ github.ref }} | |
提交信息: ${{ github.event.head_commit.message }} | |
提交人: ${{ github.actor }} | |
状态: 构建成功(https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) | |
on-failure: | |
needs: publish | |
runs-on: ubuntu-latest | |
container: whatwewant/zmicro:v1.16.5 | |
if: ${{ always() && needs.publish.result == 'failure' }} | |
steps: | |
- name: Notification Feishu | |
uses: whatwewant/[email protected] | |
with: | |
url: ${{ secrets.NPM_VERSION_FEISHU_BOT_WEBHOOK_URL }} | |
title: '❌ NPM 发布:${{ github.repository }}' | |
text: | | |
分支: ${{ github.ref }} | |
提交信息: ${{ github.event.head_commit.message }} | |
提交人: ${{ github.actor }} | |
状态: 构建失败(https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) | |
publish: | |
# bootstrap: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# container: whatwewant/node-builder:v16-1.4.5 | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- name: Get Current Date | |
id: date | |
run: echo "::set-output name=date::$(date +'%Y-%m-%d')" | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: '0' | |
# - name: Fix Git Permissions | |
# run: git config --global --add safe.directory $PWD | |
# - name: Config git | |
# run: zmicro config git Zero [email protected] | |
- name: Get ENV | |
run: | | |
env | |
ls -al | |
#INPUT_EMAIL="${INPUT_EMAIL:-'[email protected]'}" | |
#INPUT_NAME="${INPUT_NAME:-'GitHub Action'}" | |
#INPUT_ACTOR=${INPUT_ACTOR:-${GITHUB_ACTOR}} | |
#git config user.email "${INPUT_EMAIL}" | |
#git config user.name "${INPUT_NAME}" | |
#git config user.password ${INPUT_TOKEN} | |
#echo "GIT_USER=${INPUT_ACTOR}:${INPUT_TOKEN}" >> $GITHUB_ENV | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
#- uses: oleksiyrudenko/gha-git-credentials@v2-latest | |
# with: | |
# token: '${{ secrets.GITHUB_TOKEN }}' | |
# Runs a single command using the runners shell | |
- name: Use Node.js | |
# uses: actions/setup-node@v1 | |
uses: zmicro-design/action-setup-node@v1 | |
with: | |
node-version: 14.x | |
registry-url: https://registry.npmjs.org | |
- name: Cache node_modules | |
uses: actions/cache@v2 | |
id: yarn-cache | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
- name: Install Dependencies | |
run: yarn bootstrap | |
# build: | |
# needs: bootstrap | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v2 | |
# with: | |
# fetch-depth: '0' | |
# - name: Restore node_modules cache | |
# uses: actions/cache@v2 | |
# id: yarn-cache | |
# with: | |
# path: ~/.npm | |
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
- name: Before Build | |
run: cp tsconfig.prod.json tsconfig.json | |
- name: Make Build | |
run: yarn build | |
- name: After Build | |
run: git checkout tsconfig.json | |
# test: | |
# needs: build | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v2 | |
# with: | |
# fetch-depth: '0' | |
# - name: Restore node_modules cache | |
# uses: actions/cache@v2 | |
# id: yarn-cache | |
# with: | |
# path: ~/.npm | |
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
- name: Make Testing | |
run: yarn test | |
# coverage: | |
# needs: build | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v2 | |
# with: | |
# fetch-depth: '0' | |
# - name: Restore node_modules cache | |
# uses: actions/cache@v2 | |
# id: yarn-cache | |
# with: | |
# path: ~/.npm | |
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
- name: Make Coverage | |
run: yarn coverage | |
# publish: | |
# needs: [test, coverage] | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v2 | |
# with: | |
# fetch-depth: '0' | |
- name: Before Publish | |
run: cp .npmrc.template .npmrc | |
# Runs a set of commands using the runners shell | |
- name: Make Publish | |
run: yarn lerna publish --yes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} |