# action for bundle taro react native project
# remove this file if you don't need it
# see https://github.com/zhiqingchen/taro-react-native-release for details.

on:
  push:
    tags: [ b* ]
  workflow_dispatch:

jobs:
  taro_release_job:
    runs-on: ubuntu-latest
    name: Taro Bundle Release
    steps:
      - name: Checkout Project
        uses: actions/checkout@v2
      - name: Cache node_modules Folder
        uses: actions/cache@v2
        with:
          path: ${{ github.workspace }}/node_modules
          key: ${{ runner.os }}-node_modules
          restore-keys: ${{ runner.os }}-node_modules
      - name: Get Yarn Cache Directory Path
        id: yarn-cache-dir-path
        run: echo "::set-output name=dir::$(yarn cache dir)"
      - name: Cache Yarn
        uses: actions/cache@v2
        env:
          cache-name: yarn-cache
        with:
          path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
          key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
          restore-keys: |
            ${{ runner.os }}-yarn-
      - name: Install Dependencies
        run: |
          yarn
      - name: Release Taro React Native bundle
        uses: zhiqingchen/taro-react-native-release@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
      - name: Upload Qr Image
        uses: actions/upload-artifact@v2
        with:
          name: bundle-qr-code
          path: |
            release/qrcode/ios.png
            release/qrcode/android.png