github.com/epsagon/epsagon-go@v1.39.0/.github/workflows/main.yml (about)

     1  name: CI
     2  
     3  # Controls when the action will run. Triggers the workflow on push or pull request
     4  # events but only for the main branch
     5  on:
     6    push:
     7      branches:
     8        - master
     9  # A workflow run is made up of one or more jobs that can run sequentially or in parallel
    10  jobs:
    11    # This workflow contains a single job called "build"
    12    build:
    13      # The type of runner that the job will run on
    14      runs-on: ubuntu-latest
    15      if: "!contains(github.event.head_commit.message, 'Increasing version')" 
    16      # Steps represent a sequence of tasks that will be executed as part of the job
    17      steps:
    18        # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
    19        - uses: actions/checkout@v2
    20          with:
    21            token: ${{ secrets.INCREASE_VERSION_TOKEN }}
    22        # Runs a set of commands using the runners shell
    23        - name: Update version
    24          env:
    25            # This is necessary in order to push a commit to the repo
    26            GITHUB_TOKEN: ${{ secrets.INCREASE_VERSION_TOKEN }}
    27          run: |
    28            git remote add github "https://maorlx:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git"
    29            git pull github ${GITHUB_REF} --ff-only
    30            git config --global user.email "maor@epsagon.com"
    31            git config --global user.name "Maor Levi"
    32            version=`cat tracer/version.go | egrep "const VERSION = " | tr -s ' ' | cut -d ' ' -f 4`
    33            minor=`echo $version | cut -d. -f2`
    34            major=`echo $version | cut -d. -f1`
    35            patch=`echo $version | cut -d. -f3`
    36            new_minor=`echo "$((minor+1))"`
    37            new_version="${major}.${new_minor}.${patch}"
    38            echo $new_version
    39            sed -i "s/${version}/${new_version}/g" tracer/version.go
    40            git commit -m "Increasing version to $new_version" tracer/version.go
    41            git push github HEAD:${GITHUB_REF}