Skip to content

Commit

Permalink
feat: add release prod action
Browse files Browse the repository at this point in the history
  • Loading branch information
rsonghuster committed Dec 29, 2023
1 parent 596d555 commit 0a528e2
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/registry-publish.yaml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down

0 comments on commit 0a528e2

Please sign in to comment.