内容分发网络(cdn):更新v3接口 V3GetBandwidthData /2016-09-01/statistics/GetBandw… #15
This file contains hidden or 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
| # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created | |
| # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages | |
| name: tag/release/publish | |
| on: | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| # 推送到 master 分支时自动触发 | |
| push: | |
| branches: | |
| - master | |
| - main | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| with: | |
| fetch-depth: 0 # 获取完整的 git 历史 | |
| - uses: actions/setup-node@v2 | |
| with: | |
| node-version: 16 | |
| registry-url: https://registry.npmjs.org/ | |
| - name: Install dependencies | |
| run: npm i | |
| - name: Run tests | |
| run: npm run test | |
| - name: Build | |
| run: npm run build | |
| - name: Configure git | |
| run: | | |
| git config --global user.email "autotag@ksyun.com" | |
| git config --global user.name "autotag" | |
| - name: Commit build files | |
| run: git add . && git commit -m 'build' || echo "No changes to commit" | |
| - name: Get version from package.json | |
| id: package-version | |
| run: echo "version=v$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT | |
| - name: Create and push tag | |
| run: | | |
| git tag ${{ steps.package-version.outputs.version }} | |
| git push origin ${{ steps.package-version.outputs.version }} | |
| - name: Create GitHub Release | |
| run: gh release create ${{ steps.package-version.outputs.version }} --generate-notes | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Publish to npm | |
| run: npm publish | |
| env: | |
| NODE_AUTH_TOKEN: ${{secrets.npm_token}} |