chore: ci #3
Workflow file for this run
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 | ||
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 💚 | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
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 }} |