|
| 1 | +name: Deploy |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + paths: |
| 6 | + - rockspecs/*.rockspec |
| 7 | + |
| 8 | +jobs: |
| 9 | + |
| 10 | + affected: |
| 11 | + runs-on: ubuntu-20.04 |
| 12 | + outputs: |
| 13 | + rockspecs: '["${{ steps.changed-files.outputs.all_modified_files }}"]' |
| 14 | + steps: |
| 15 | + - name: Checkout |
| 16 | + uses: actions/checkout@v3 |
| 17 | + with: |
| 18 | + fetch-depth: 0 |
| 19 | + - id: changed-files |
| 20 | + uses: tj-actions/changed-files@v17 |
| 21 | + with: |
| 22 | + files: rockspecs/*.rockspec |
| 23 | + separator: '", "' |
| 24 | + |
| 25 | + build: |
| 26 | + needs: affected |
| 27 | + if: ${{ needs.affected.outputs.rockspecs }} |
| 28 | + strategy: |
| 29 | + fail-fast: false |
| 30 | + matrix: |
| 31 | + # Upstream Issue: https://github.com/leafo/gh-actions-luarocks/issues/8 |
| 32 | + luaVersion: ["5.4", "5.3", "5.2", "5.1"] #, "luajit", "luajit-openresty"] |
| 33 | + # Upstream Issue: https://github.com/leafo/gh-actions-luarocks/issues/8 |
| 34 | + luarocksVersion: ["3.1.3"] # , "2.4.2"] |
| 35 | + rockspec: ${{ fromJSON(needs.affected.outputs.rockspecs) }} |
| 36 | + runs-on: ubuntu-20.04 |
| 37 | + steps: |
| 38 | + - name: Checkout |
| 39 | + uses: actions/checkout@v3 |
| 40 | + - name: Setup ‘lua’ |
| 41 | + uses: leafo/gh-actions-lua@v8 |
| 42 | + with: |
| 43 | + luaVersion: ${{ matrix.luaVersion }} |
| 44 | + - name: Setup ‘luarocks’ |
| 45 | + uses: leafo/gh-actions-luarocks@v4 |
| 46 | + with: |
| 47 | + luarocksVersion: ${{ matrix.luarocksVersion }} |
| 48 | + - name: Confirm rockspec builds |
| 49 | + run: | |
| 50 | + luarocks --lua-version ${{ matrix.luaVersion }} --local build -- ${{ matrix.rockspec }} |
| 51 | +
|
| 52 | + upload: |
| 53 | + needs: [affected, build] |
| 54 | + if: ${{ needs.affected.outputs.rockspecs && github.ref == 'refs/heads/master' && github.repository == 'alerque/fluent-lua' }} |
| 55 | + strategy: |
| 56 | + fail-fast: false |
| 57 | + matrix: |
| 58 | + rockspec: ${{ fromJSON(needs.affected.outputs.rockspecs) }} |
| 59 | + runs-on: ubuntu-20.04 |
| 60 | + steps: |
| 61 | + - name: Checkout |
| 62 | + uses: actions/checkout@v3 |
| 63 | + - name: Setup ‘lua’ |
| 64 | + uses: leafo/gh-actions-lua@v8 |
| 65 | + - name: Setup ‘luarocks’ |
| 66 | + uses: leafo/gh-actions-luarocks@v4 |
| 67 | + - name: Setup dependencies |
| 68 | + run: | |
| 69 | + luarocks install dkjson |
| 70 | + - run: | |
| 71 | + luarocks upload --force --api-key ${{ secrets.LUAROCKS_APIKEY }} -- ${{ matrix.rockspec }} |
0 commit comments