name: Packaging

on:
    pull_request:
    push:
        branches:
            - main
            - stable*

jobs:
  release-tarball:
    runs-on: ubuntu-latest
    name: Build release tarball
    steps:
      - name: Checkout
        uses: actions/checkout@master
      - name: Set up Node
        uses: actions/setup-node@v2.5.0
        with:
          node-version: 14.x
      - name: Set up php$
        uses: shivammathur/setup-php@master
        with:
          php-version: 7.4
          tools: composer:v1
          extensions: ctype,curl,dom,gd,iconv,intl,json,mbstring,openssl,posix,sqlite,xml,zip
          coverage: none
      - name: Install Krankerl
        run: |
          wget https://github.com/ChristophWurst/krankerl/releases/download/v0.13.0/krankerl_0.13.0_amd64.deb
          sudo dpkg -i krankerl_0.13.0_amd64.deb
      - name: Package app
        run: krankerl package
      - uses: actions/upload-artifact@v2
        with:
          path: build/artifacts/mail.tar.gz
          if-no-files-found: error
