name: Build and Publish Assets built for Releases

on:
  release:
    types:
      - created

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
        with:
          path: 'frappe'
      - uses: actions/setup-node@v1
        with:
          python-version: '12.x'
      - uses: actions/setup-python@v2
        with:
          python-version: '3.6'
      - name: Set up bench for current push
        run: |
          npm install -g yarn
          pip3 install -U frappe-bench
          bench init frappe-bench --no-procfile --no-backups --skip-assets --skip-redis-config-generation --python $(which python) --frappe-path $GITHUB_WORKSPACE/frappe
          cd frappe-bench && bench build

      - name: Package assets
        run: |
          mkdir -p $GITHUB_WORKSPACE/build
          tar -cvpzf $GITHUB_WORKSPACE/build/$GITHUB_SHA.tar.gz ./frappe-bench/sites/assets/js ./frappe-bench/sites/assets/css

      - name: Attach Assets to Release
        uses: svenstaro/upload-release-action@v2
        with:
          repo_token: ${{ secrets.GITHUB_TOKEN }}
          file: $GITHUB_WORKSPACE/build/$GITHUB_SHA.tar.gz
          asset_name: assets.tar.gz
          tag: ${{ github.ref }}
          overwrite: true
          body: "Assets automatically generated which may be used to avoid re-building on local benches"

name: Build and Publish Assets built for Releases

on:
  release:
    types: [ created ]

env:
  GITHUB_TOKEN: ${{ github.token }}

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
        with:
          path: 'frappe'
      - uses: actions/setup-node@v1
        with:
          python-version: '12.x'
      - uses: actions/setup-python@v2
        with:
          python-version: '3.6'
      - name: Set up bench for current push
        run: |
          npm install -g yarn
          pip3 install -U frappe-bench
          bench init frappe-bench --no-procfile --no-backups --skip-assets --skip-redis-config-generation --python $(which python) --frappe-path $GITHUB_WORKSPACE/frappe
          cd frappe-bench && bench build

      - name: Package assets
        run: |
          mkdir -p $GITHUB_WORKSPACE/build
          tar -cvpzf $GITHUB_WORKSPACE/build/assets.tar.gz ./frappe-bench/sites/assets/js ./frappe-bench/sites/assets/css

      - name: Get release
        id: get_release
        uses: bruceadams/get-release@v1.2.0

      - name: Upload built Assets to Release
        uses: actions/upload-release-asset@v1.0.2
        with:
          upload_url: ${{ steps.get_release.outputs.upload_url }}
          asset_path: build/assets.tar.gz
          asset_name: assets.tar.gz
          asset_content_type: application/octet-stream


Use a different action to attach built asset
fix: Use a different action to attach built asset
