Skip to content

Commit 8b503c4

Browse files
committed
ci: add version bump workflow
1 parent ae033f4 commit 8b503c4

2 files changed

Lines changed: 70 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ on:
2121
paths-ignore:
2222
- '**/*.md'
2323
- '.github/*.yml'
24+
- '.github/workflows/bump-version.yml'
2425
- '.github/workflows/licensecheck.yml'
2526
- '.github/workflows/validate_pr.yml'
2627
- '**/.project'

.github/workflows/bump-version.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
2+
name: Bump Version
3+
4+
on:
5+
workflow_dispatch:
6+
# https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/
7+
inputs:
8+
type:
9+
description: Type
10+
default: micro'
11+
required: true
12+
type: choice
13+
options:
14+
- major
15+
- minor
16+
- micro
17+
18+
19+
defaults:
20+
run:
21+
shell: bash
22+
23+
24+
jobs:
25+
26+
###########################################################
27+
bump-version:
28+
###########################################################
29+
runs-on: ubuntu-latest
30+
31+
steps:
32+
- name: "Show: GitHub context"
33+
env:
34+
GITHUB_CONTEXT: ${{ toJSON(github) }}
35+
run: echo $GITHUB_CONTEXT
36+
37+
38+
- name: "Show: environment variables"
39+
run: env | sort
40+
41+
42+
- name: Git Checkout
43+
uses: actions/checkout@v4 # https://github.com/actions/checkout
44+
with:
45+
fetch-depth: 0 # required to prevent tycho-p2-extras-plugin:compare-version-with-baseline potentially failing the build
46+
47+
- name: Bump Version
48+
run: python bump-version.py ${{ github.event.inputs.type }}
49+
50+
- name: Configure Git
51+
run: |
52+
git config user.name "github-actions[bot]"
53+
git config user.email "github-actions[bot]@users.noreply.github.com"
54+
55+
- name: Commit changes
56+
run: |
57+
git add .
58+
59+
projectVersion=$(python -c "import xml.etree.ElementTree as ET; \
60+
print(ET.parse(open('pom.xml')).getroot().find( \
61+
'{http://maven.apache.org/POM/4.0.0}version').text)")
62+
63+
git commit -m "set tm4e version to $projectVersion"
64+
65+
- name: Push changes
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
run: |
69+
git push origin HEAD:${{ github.ref_name }}

0 commit comments

Comments
 (0)