how to trigger a python script on release cut in github using git actions?

59 Views Asked by At

I want to trigger a python script on dynamic runner if any new release cut happens using github actions.

what i am trying is :

on:
  push:
    tags:
      - 'v*'
jobs:
  RunScript:
    runs-on: ubuntu-latest
    if: github.event.pull_request.merged == true
    steps:
      - name: Run Python Script
        id: PyScript
        run: |
          pip install semantic_version
          `python3 ./build-scripts/test.py`

please suggest a better way if any. thanks

1

There are 1 best solutions below

0
Dayananda D R On

You can use conditional statement so that it triggers on any release cu and it need not to start with "v"

on:
  push:
    tags:
      - '*'
jobs:
  RunScript:
    runs-on: ubuntu-latest
    if: (startsWith(github.ref, 'refs/tags/'))
    steps:
      - name: Run Python Script
        id: PyScript
        run: |
          pip install semantic_version
          `python3 ./build-scripts/test.py`