This repository was archived by the owner on Jun 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
41 lines (40 loc) · 1.78 KB
/
main.yml
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
38
39
40
41
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the main branch
on:
push:
branches:
- master
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'Increasing version')"
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
token: ${{ secrets.INCREASE_VERSION_TOKEN }}
# Runs a set of commands using the runners shell
- name: Update version
env:
# This is necessary in order to push a commit to the repo
GITHUB_TOKEN: ${{ secrets.INCREASE_VERSION_TOKEN }}
run: |
git remote add github "https://maorlx:[email protected]/$GITHUB_REPOSITORY.git"
git pull github ${GITHUB_REF} --ff-only
git config --global user.email "[email protected]"
git config --global user.name "Maor Levi"
version=`cat tracer/version.go | egrep "const VERSION = " | tr -s ' ' | cut -d ' ' -f 4`
minor=`echo $version | cut -d. -f2`
major=`echo $version | cut -d. -f1`
patch=`echo $version | cut -d. -f3`
new_minor=`echo "$((minor+1))"`
new_version="${major}.${new_minor}.${patch}"
echo $new_version
sed -i "s/${version}/${new_version}/g" tracer/version.go
git commit -m "Increasing version to $new_version" tracer/version.go
git push github HEAD:${GITHUB_REF}