diff --git a/.github/workflows/push_rockspec.yml b/.github/workflows/push_rockspec.yml new file mode 100644 index 0000000..4100d79 --- /dev/null +++ b/.github/workflows/push_rockspec.yml @@ -0,0 +1,48 @@ +name: Push rockspec + +on: + workflow_run: + workflows: ["Run tests"] + branches: [master] + types: + - completed + push: + tags: + - '*' + +env: + ROCK_NAME: "luagraphqlparser" + +jobs: + push-scm-rockspec: + runs-on: [ ubuntu-22.04 ] + if: github.ref == 'refs/heads/master' && github.event.workflow_run.conclusion == 'success' + steps: + - uses: actions/checkout@master + + - uses: tarantool/rocks.tarantool.org/github-action@master + with: + auth: ${{ secrets.ROCKS_AUTH }} + files: ${{ env.ROCK_NAME }}-scm-1.rockspec + + push-tagged-rockspec: + runs-on: [ ubuntu-22.04 ] + if: startsWith(github.ref, 'refs/tags') + steps: + - uses: actions/checkout@master + + # https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions + - name: Set env + run: echo "GIT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: Push release rockspec + run: | + sed \ + -e "s/branch = '.\+'/tag = '${GIT_TAG}'/g" \ + -e "s/version = '.\+'/version = '${GIT_TAG}-1'/g" \ + ${{ env.ROCK_NAME }}-scm-1.rockspec > ${{ env.ROCK_NAME }}-${GIT_TAG}-1.rockspec + + - uses: tarantool/rocks.tarantool.org/github-action@master + with: + auth: ${{ secrets.ROCKS_AUTH }} + files: ${{ env.ROCK_NAME }}-${GIT_TAG}-1.rockspec