|
| 1 | +name: publish |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [master] |
| 6 | + tags: ['*'] |
| 7 | + |
| 8 | +jobs: |
| 9 | + publish-scm-1: |
| 10 | + if: github.ref == 'refs/heads/master' |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v2 |
| 14 | + - uses: tarantool/rocks.tarantool.org/github-action@master |
| 15 | + with: |
| 16 | + auth: ${{ secrets.ROCKS_AUTH }} |
| 17 | + files: expirationd-scm-1.rockspec |
| 18 | + |
| 19 | + publish-tag: |
| 20 | + if: startsWith(github.ref, 'refs/tags/') |
| 21 | + runs-on: ubuntu-latest |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v2 |
| 24 | + |
| 25 | + # Create a rockspec for the release. |
| 26 | + - run: printf '%s=%s\n' TAG "${GITHUB_REF##*/}" >> "${GITHUB_ENV}" |
| 27 | + - run: sed -E |
| 28 | + -e 's/branch = ".+"/tag = "${{ env.TAG }}"/g' |
| 29 | + -e 's/version = ".+"/version = "${{ env.TAG }}-1"/g' |
| 30 | + expirationd-scm-1.rockspec > expirationd-${{ env.TAG }}-1.rockspec |
| 31 | + |
| 32 | + # Create a rock for the release (.all.rock). |
| 33 | + # |
| 34 | + # `tarantoolctl rocks pack <module_name> <version>` creates |
| 35 | + # .all.rock tarball. It speeds up |
| 36 | + # `tarantoolctl rocks install <module_name> <version>` and |
| 37 | + # frees it from dependency on git. |
| 38 | + # |
| 39 | + # Don't confuse this command with |
| 40 | + # `tarantoolctl rocks pack <rockspec>`, which creates a |
| 41 | + # source tarball (.src.rock). |
| 42 | + # |
| 43 | + # Important: Don't upload binary rocks to |
| 44 | + # rocks.tarantool.org. Lua/C modules should be packed into |
| 45 | + # .src.rock instead. See [1] for description of rock types. |
| 46 | + # |
| 47 | + # [1]: https://github.com/luarocks/luarocks/wiki/Types-of-rocks |
| 48 | + - uses: tarantool/setup-tarantool@v1 |
| 49 | + with: |
| 50 | + tarantool-version: '1.10' |
| 51 | + - run: tarantoolctl rocks install expirationd-${{ env.TAG }}-1.rockspec |
| 52 | + - run: tarantoolctl rocks pack expirationd ${{ env.TAG }} |
| 53 | + |
| 54 | + # Upload .rockspec and .all.rock. |
| 55 | + - uses: tarantool/rocks.tarantool.org/github-action@master |
| 56 | + with: |
| 57 | + auth: ${{ secrets.ROCKS_AUTH }} |
| 58 | + files: | |
| 59 | + expirationd-${{ env.TAG }}-1.rockspec |
| 60 | + expirationd-${{ env.TAG }}-1.all.rock |
0 commit comments