-
Notifications
You must be signed in to change notification settings - Fork 3
86 lines (76 loc) · 2.45 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Publish
on:
workflow_dispatch:
inputs:
package:
type: choice
description: choose package
default: 'iris-web-rtc'
required: true
options:
- iris-web-rtc
- iris-web-rtm
version:
description: x.x.x-semver.x, semver: dev,build
required: true
default: 'patch'
type: string
releases:
description: create Releases, choose false if specify version
default: true
type: boolean
cdn:
description: upload to cdn
default: true
type: boolean
release_type:
description: The release type of CDN
default: 'staging'
type: string
npm:
description: upload to npm
default: false
type: boolean
jobs:
release-it:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup
uses: ./.github/actions/setup
- name: Setup Dependencies 💚
run: |
pnpm install
- name: CDN Publish
if: ${{ inputs.cdn }}
run: |
UPLOAD_CDN_INTERNAL_JENKINS_HOOK=${{ inputs.upload_cdn_internal_jenkins_hook }}
UPLOAD_URL=${{ inputs.url }}
RELEASE_TYPE=${{ inputs.release_type }}
curl -X POST ${UPLOAD_CDN_INTERNAL_JENKINS_HOOK} \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d "{ \"release\": { \"assets\": [ { \"browser_download_url\": \"${UPLOAD_URL}\", \"release_type\": \"${RELEASE_TYPE}\" } ] }}"
shell: bash
- name: Setup NPM auth token
if: ${{ inputs.npm }}
run: |
npm set "//registry.npmjs.org/:_authToken" ${{ secrets.NPM_TOKEN }}
- name: Config Git
if: ${{ inputs.npm }}
run: |
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git config --global user.name "${{ github.actor }}"
- name: Update CHANGELOG.md
if: ${{ inputs.npm }}
run: |
pnpm release ${{ inputs.version }} --ci --no-git.tag --no-github.release --npm.allowSameVersion
- name: NPM Publish
if: ${{ inputs.npm }}
run: |
pnpm -F ${{ inputs.package }} release ${{ inputs.version }} --ci --github.release=${{ inputs.releases }}