name: android CI/CD上传

on:
  push:
    tags:
      - "v*.*.*"
#  push:
#    branches:
#      - master  # 当推送到 main 分支时触发流水线

jobs:
  build:
    runs-on: ubuntu-latest


    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '16'
          registry-url: 'https://registry.npmjs.org/'
          scope: '@${{ github.repository_owner }}'

      - name: 替换环境变量
        run: |
          sed -i 's|{NPM_TOKEN}|${{secrets.NPM_TOKEN}}|g' ./.npmrc

      - name: setConfig
        run: |
          npm config set userconfig ./.npmrc

      - name: 编译和打包
        run: |
          npm install

      - name: 上传构建产物
        run: |
          npm publish