|
| 1 | +name: Build & Release draft |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + deploy: |
| 7 | + name: build dependencies & create artifact |
| 8 | + runs-on: ubuntu-latest |
| 9 | + steps: |
| 10 | + - name: Checkout |
| 11 | + |
| 12 | + |
| 13 | + - name: Clone PrestaShop for core dependencies |
| 14 | + run: | |
| 15 | + git clone --depth=50 https://github.com/PrestaShop/PrestaShop.git ~/PrestaShop |
| 16 | + rm -rf ~/PrestaShop/modules/blockwishlist |
| 17 | + cd .. |
| 18 | + mv blockwishlist ~/PrestaShop/modules |
| 19 | + ln -s ~/PrestaShop/modules/blockwishlist |
| 20 | + cd blockwishlist |
| 21 | +
|
| 22 | + - name: Install Node.js |
| 23 | + uses: actions/setup-node@v1 |
| 24 | + with: |
| 25 | + node-version: 12.x |
| 26 | + |
| 27 | + - run: yarn install |
| 28 | + |
| 29 | + - name: Build JS dependencies |
| 30 | + run: | |
| 31 | + yarn --cwd ~/PrestaShop/modules/blockwishlist run build |
| 32 | + rm -rf node_modules |
| 33 | +
|
| 34 | + - name: Install composer dependencies |
| 35 | + run: composer install --no-dev -o |
| 36 | + |
| 37 | + - name: Clean-up project |
| 38 | + uses: PrestaShopCorp/[email protected] |
| 39 | + with: |
| 40 | + paths: node_modules |
| 41 | + |
| 42 | + - name: Create & upload artifact |
| 43 | + uses: actions/upload-artifact@v1 |
| 44 | + with: |
| 45 | + name: ${{ github.event.repository.name }} |
| 46 | + path: ../ |
| 47 | + |
| 48 | + update_release_draft: |
| 49 | + runs-on: ubuntu-latest |
| 50 | + needs: [deploy] |
| 51 | + if: github.event_name == 'push' && github.event.ref == 'refs/heads/master' |
| 52 | + steps: |
| 53 | + - name: Download artifact |
| 54 | + uses: actions/download-artifact@v1 |
| 55 | + with: |
| 56 | + name: ${{ github.event.repository.name }} |
| 57 | + |
| 58 | + - id: release_info |
| 59 | + uses: toolmantim/release-drafter@v5 |
| 60 | + env: |
| 61 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 62 | + |
| 63 | + - name: Prepare for Release |
| 64 | + run: | |
| 65 | + cd ${{ github.event.repository.name }} |
| 66 | + zip -r ${{ github.event.repository.name }}.zip ${{ github.event.repository.name }} |
| 67 | +
|
| 68 | + - name: Clean existing assets |
| 69 | + shell: bash |
| 70 | + run: | |
| 71 | + curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1 |
| 72 | + assets=`bin/hub api -t repos/${{ github.repository }}/releases/${{ steps.release_info.outputs.id }}/assets | awk '/\].url/ { print $2 }'` |
| 73 | + for asset in $assets |
| 74 | + do |
| 75 | + bin/hub api -X DELETE $asset |
| 76 | + done |
| 77 | + env: |
| 78 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 79 | + |
| 80 | + - name: Publish to GitHub Release |
| 81 | + |
| 82 | + env: |
| 83 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 84 | + with: |
| 85 | + upload_url: ${{ steps.release_info.outputs.upload_url }} |
| 86 | + asset_path: ./${{ github.event.repository.name }}/${{ github.event.repository.name }}.zip |
| 87 | + asset_name: ${{ github.event.repository.name }}.zip |
| 88 | + asset_content_type: application/zip |
0 commit comments