summaryrefslogtreecommitdiff
path: root/.github/workflows/update-code-version.yml
blob: 1e034097ea72ca12748dc5c6baff41ea6cc9def4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# @format

name: Update Version

on:
  push:
    tags:
      - "v*"

jobs:
  update-version:
    runs-on: ubuntu-latest

    steps:
      - name: Check out code
        uses: actions/checkout@v2

      - name: Extract version from tag
        run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV

      - name: Select main branch
        run: git checkout main

      - name: Update version in pyproject.toml
        run: |
          sed -i "s/version = \".*\"/version = \"$VERSION\"/" pyproject.toml

      - name: Update version in robusta_krr/__init__.py
        run: |
          sed -i "s/__version__ = \".*\"/__version__ = \"$VERSION\"/" robusta_krr/__init__.py

      - name: Commit and push
        run: |
          git config --local user.email "action@github.com"
          git config --local user.name "GitHub Action"
          git add pyproject.toml robusta_krr/__init__.py
          git commit -m "Update version to $VERSION" && git push