Skip to content

Commit

Permalink
build(project): feat/release-automation (element-plus#1094)
Browse files Browse the repository at this point in the history
- Add publish.sh for automated publishing
  • Loading branch information
jw-foss authored Dec 23, 2020
1 parent ab4841c commit 97e8848
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 6 deletions.
34 changes: 31 additions & 3 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,36 @@ jobs:
- uses: actions/setup-node@v1
with:
registry-url: https://registry.npmjs.org/
- run: yarn bootstrap
- run: yarn build
- run: npm publish --access public
- name: Get version
run: echo "TAG_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Bootstrap
run: yarn bootstrap
- name: build
run: yarn build
- name: Publish
run: sh ./scripts/publish.sh
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
TAG_VERSION: ${{env.TAG_VERSION}}
REGISTRY: https://npm.pkg.github.com/

publish-gpr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://npm.pkg.github.com/
- name: Get version
run: echo "TAG_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Bootstrap
run: yarn bootstrap
- name: build
run: yarn build
- name: Publish
run: sh ./scripts/publish.sh
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
TAG_VERSION: ${{env.TAG_VERSION}}
REGISTRY: https://npm.pkg.github.com/
5 changes: 4 additions & 1 deletion packages/skeleton-item/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { App } from 'vue'
import SkeletonItem from './src/index.vue'
import type { SFCWithInstall } from '@element-plus/utils/types'

SkeletonItem.install = (app: App): void => {
app.component(SkeletonItem.name, SkeletonItem)
}

export default SkeletonItem
const _SkeletonItem: SFCWithInstall<typeof SkeletonItem> = SkeletonItem

export default _SkeletonItem
5 changes: 4 additions & 1 deletion packages/skeleton/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { App } from 'vue'
import Skeleton from './src/index.vue'
import type { SFCWithInstall } from '@element-plus/utils/types'

Skeleton.install = (app: App): void => {
app.component(Skeleton.name, Skeleton)
}

export default Skeleton
const _Skeleton: SFCWithInstall<typeof Skeleton> = Skeleton

export default _Skeleton
5 changes: 4 additions & 1 deletion packages/space/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { App } from 'vue'
import Space from './src/index'
import type { SFCWithInstall } from '@element-plus/utils/types'

Space.install = (app: App): void => {
app.component(Space.name, Space)
}

export default Space
const _Space: SFCWithInstall<typeof Space> = Space as any

export default _Space
11 changes: 11 additions & 0 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#! /usr/bin/bash

# Do not run this file without setting the environment variables, you will end up fatal error
# If you wish to run this locally, please change the env variable before running this.

WORKING_PATH="../$(dirname $0)"
cd $WORKING_PATH

cat package.json | grep -v '"private":' | grep -v '"version":' | sed "s/\(\"name\": \"@element-plus\/icons\"\)/\1,\n \"version\": \"${TAG_VERSION}\"/g" > package.json

npm publish --registry ${REGISTRY} --access public

0 comments on commit 97e8848

Please sign in to comment.