File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Build stage
2+ FROM rust:1.85-slim AS builder
3+
4+ RUN apt-get update && apt-get install -y \
5+ pkg-config \
6+ libssl-dev \
7+ cmake \
8+ git \
9+ && rm -rf /var/lib/apt/lists/*
10+
11+ WORKDIR /usr/src/git-versioner
12+ COPY . .
13+
14+ RUN cargo build --release
15+
16+ # Final stage
17+ FROM debian:bookworm-slim
18+
19+ RUN apt-get update && apt-get install -y \
20+ libssl3 \
21+ ca-certificates \
22+ git \
23+ && rm -rf /var/lib/apt/lists/*
24+
25+ COPY --from=builder /usr/src/git-versioner/target/release/git-versioner /usr/local/bin/git-versioner
26+ COPY entrypoint.sh /entrypoint.sh
27+ RUN chmod +x /entrypoint.sh
28+
29+ ENTRYPOINT ["/entrypoint.sh" ]
Original file line number Diff line number Diff line change @@ -105,6 +105,43 @@ You can install Git Versioner directly from [crates.io](https://crates.io/crates
105105cargo install git-versioner
106106```
107107
108+ ### GitHub Action
109+
110+ Git Versioner can be used directly as a GitHub Action.
111+ It will automatically export the calculated version components to ` GITHUB_OUTPUT ` .
112+ Outputs are available with a ` GitVersion_ ` prefix (e.g., ` GitVersion_SemVer ` ) and also in ` PascalCase ` without prefix (e.g., ` SemVer ` ).
113+
114+ ``` yaml
115+ - name : Determine Version
116+ uses : crown0815/git-versioner@v1
117+ id : versioner
118+ with :
119+ # Optional configuration (see below for available inputs)
120+ as-release : true
121+ ` ` `
122+
123+ #### Example workflow
124+
125+ ` ` ` yaml
126+ name : CI
127+ on : [push]
128+
129+ jobs :
130+ build :
131+ runs-on : ubuntu-latest
132+ steps :
133+ - uses : actions/checkout@v4
134+ with :
135+ fetch-depth : 0 # Required to see all tags and history
136+
137+ - name : Determine Version
138+ id : versioner
139+ uses : crown0815/git-versioner@v1
140+
141+ - name : Use Version
142+ run : echo "The version is ${{ steps.versioner.outputs.SemVer }}"
143+ ` ` `
144+
108145### From Source
109146
1101471. Clone the repository:
Original file line number Diff line number Diff line change 1+ name : ' Git Versioner'
2+ description : ' Automatically calculate version numbers for Git repositories'
3+ branding :
4+ icon : ' tag'
5+ color : ' blue'
6+ inputs :
7+ path :
8+ description : ' Path to the repository to calculate the version for'
9+ required : false
10+ default : ' .'
11+ main-branch :
12+ description : ' Regex to detect the main branch'
13+ required : false
14+ release-branch :
15+ description : ' Regex to detect the release branch(es)'
16+ required : false
17+ feature-branch :
18+ description : ' Regex to detect the feature branch(es)'
19+ required : false
20+ tag-prefix :
21+ description : ' Regex to detect version tag(s)'
22+ required : false
23+ pre-release-tag :
24+ description : ' Regex to detect pre-release version tag(s)'
25+ required : false
26+ continuous-delivery :
27+ description : ' Calculate version using continuous delivery mode'
28+ required : false
29+ default : ' false'
30+ commit-message-incrementing :
31+ description : " Increment based on conventional commits (set to 'Enabled' or 'Disabled')"
32+ required : false
33+ as-release :
34+ description : ' Forces release generation instead of pre-release'
35+ required : false
36+ default : ' false'
37+ config :
38+ description : ' Path to a configuration file (TOML or YAML)'
39+ required : false
40+ runs :
41+ using : ' docker'
42+ image : ' Dockerfile'
Original file line number Diff line number Diff line change 1+ #! /bin/sh -l
2+
3+ set -e
4+
5+ # Construct arguments array
6+ ARGS=" "
7+
8+ if [ -n " $INPUT_PATH " ]; then
9+ ARGS=" $ARGS --path $INPUT_PATH "
10+ fi
11+
12+ if [ -n " $INPUT_MAIN_BRANCH " ]; then
13+ ARGS=" $ARGS --main-branch $INPUT_MAIN_BRANCH "
14+ fi
15+
16+ if [ -n " $INPUT_RELEASE_BRANCH " ]; then
17+ ARGS=" $ARGS --release-branch $INPUT_RELEASE_BRANCH "
18+ fi
19+
20+ if [ -n " $INPUT_FEATURE_BRANCH " ]; then
21+ ARGS=" $ARGS --feature-branch $INPUT_FEATURE_BRANCH "
22+ fi
23+
24+ if [ -n " $INPUT_TAG_PREFIX " ]; then
25+ ARGS=" $ARGS --tag-prefix $INPUT_TAG_PREFIX "
26+ fi
27+
28+ if [ -n " $INPUT_PRE_RELEASE_TAG " ]; then
29+ ARGS=" $ARGS --pre-release-tag $INPUT_PRE_RELEASE_TAG "
30+ fi
31+
32+ if [ " $INPUT_CONTINUOUS_DELIVERY " = " true" ]; then
33+ ARGS=" $ARGS --continuous-delivery"
34+ fi
35+
36+ if [ -n " $INPUT_COMMIT_MESSAGE_INCREMENTING " ]; then
37+ ARGS=" $ARGS --commit-message-incrementing $INPUT_COMMIT_MESSAGE_INCREMENTING "
38+ fi
39+
40+ if [ " $INPUT_AS_RELEASE " = " true" ]; then
41+ ARGS=" $ARGS --as-release"
42+ fi
43+
44+ if [ -n " $INPUT_CONFIG " ]; then
45+ ARGS=" $ARGS --config $INPUT_CONFIG "
46+ fi
47+
48+ # Run the tool
49+ # shellcheck disable=SC2086
50+ git-versioner $ARGS
You can’t perform that action at this time.
0 commit comments