diff --git a/.github/workflows/registry-publish.yaml b/.github/workflows/registry-publish.yaml new file mode 100644 index 0000000..b5e1670 --- /dev/null +++ b/.github/workflows/registry-publish.yaml @@ -0,0 +1,28 @@ +name: publish package to registry + +on: + release: + types: [created] + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 16 + registry-url: https://registry.npmjs.org/ + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y git make jq curl wget + - name: install s + run: | + npm i @serverless-devs/s@v3 -g + - name: s registry login + run: | + s registry login --token ${{ secrets.alibaba_registry_v3_publish_token }} + - name: release prod + run: | + make release-prod diff --git a/makefile b/makefile index d1d30d7..2959116 100644 --- a/makefile +++ b/makefile @@ -41,8 +41,8 @@ update-version: patch_version=$$(echo $$current_version | cut -d"." -f3); \ new_patch_version=$$((patch_version + 1)); \ new_version=$$major_version.$$minor_version.$$new_patch_version; \ - gsed -i "s/^Version: .*/Version: $$new_version/" publish.yaml; \ - git diff --exit-code + sed -i "s/^Version: .*/Version: $$new_version/" publish.yaml; \ + git diff --exit-code || true -release-prod: +release-prod: update-version npm run publish diff --git a/package.json b/package.json index fa8bc94..ba53214 100644 --- a/package.json +++ b/package.json @@ -6,12 +6,12 @@ "scripts": { "generate-schema": "npx typescript-json-schema ./src/interface/index.ts IProps --required -o ./src/schema.json", "prewatch": "mkdir -p dist && cp src/schema.json dist/schema.json", - "prebuild": "mkdir -p dist && cp src/schema.json dist/schema.json", + "prebuild": "rimraf dist && mkdir -p dist && cp src/schema.json dist/schema.json", "watch": "npx tsc -w -p tsconfig.json", "start": "npm run watch", "build": "ncc build src/index.ts -m -o dist", "format": "prettier --write src", - "publish": "rimraf dist && npm i && npm run build && s registry publish", + "publish": "npm i && npm run build && s registry publish", "lint": "f2elint scan", "fix": "f2elint fix" },