-
Notifications
You must be signed in to change notification settings - Fork 4
/
action.yml
51 lines (51 loc) · 2.33 KB
/
action.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
42
43
44
45
46
47
48
49
50
51
name: bump2version-action
description: Increment the version in one or several files using bump2version, commit, tag, and push the change.
# version: 1.0.8
author: Fragile Tech
inputs:
current_version:
description: Version of the project *before* the bump.
required: true
files:
description: List of files in which to bump the version. The format is a concatenation of paths separated by a whitespace character.
required: true
commit_name:
description: Name of the identity that is used in the commit's author signature.
required: true
commit_email:
description: Email of the identity that is used in the commit's author signature.
required: true
login:
description: GitHub user name of the identity. `bump-version` uses it together with `token` to push to the repository.
token:
description: GitHub personal access token of the identity. `bump-version` uses it together with `login` to push to the repository.
required: true
part:
description: Part of the semantic version to bump.
required: false
default: patch
runs:
using: "composite"
steps:
- shell: bash
run: |
set -x
git config --global user.name "${{ inputs.commit_name }}"
git config --global user.email "${{ inputs.commit_email }}"
git config --global pull.rebase false
BRANCH=${GITHUB_REF#refs/heads/}
pip install --no-cache-dir bump2version
git remote add ${{ inputs.login }} https://${{ inputs.login }}:${{ inputs.token }}@github.com/$GITHUB_REPOSITORY
git pull --no-edit ${{ inputs.login }} $BRANCH
git config --global url."https://${{ inputs.login }}:${{ inputs.token }}@github.com/".insteadOf "https://github.com/"
# merge done by git pull does not update submodules changed in $BRANCH
git submodule update --init --recursive
git config --global --unset url."https://${{ inputs.login }}:${{ inputs.token }}@github.com/".insteadOf
git diff
for file in ${{ inputs.files }}; do ~/.local/bin/bumpversion --allow-dirty --current-version ${{ inputs.current_version }} ${{ inputs.part }} $file; done
git diff
~/.local/bin/bumpversion --tag --current-version ${{ inputs.current_version }} --commit --allow-dirty --commit-args="-a" ${{ inputs.part }}
git push --tags ${{ inputs.login }} HEAD:$BRANCH
branding:
color: purple
icon: bar-chart-2