-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcollect-version-info.yaml
More file actions
51 lines (47 loc) · 1.87 KB
/
collect-version-info.yaml
File metadata and controls
51 lines (47 loc) · 1.87 KB
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
# This action shows how to collect version information and propagate it to the next job.
name: Collect Version Info
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
collect-version-info:
runs-on: ubuntu-latest
outputs:
current_version: ${{ steps.version-info.outputs.current_version }}
current_major_version: ${{ steps.version-info.outputs.current_major_version }}
current_minor_version: ${{ steps.version-info.outputs.current_minor_version }}
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-tags: true # in case your version provider is cvs
- uses: commitizen-tools/setup-cz@main
- id: version-info
run: |
# Gather version information
current_version="$(cz version -p)"
current_major_version="$(cz version -p --major)"
current_minor_version="$(cz version -p --minor)"
# Set output variables
echo "current_version=$current_version" >> $GITHUB_OUTPUT
echo "current_major_version=$current_major_version" >> $GITHUB_OUTPUT
echo "current_minor_version=$current_minor_version" >> $GITHUB_OUTPUT
read-version-info:
runs-on: ubuntu-latest
needs: collect-version-info
steps:
- name: Checkout code
uses: actions/checkout@v6
- run: |
# Read version information
current_version="${{ needs.collect-version-info.outputs.current_version }}"
current_major_version="${{ needs.collect-version-info.outputs.current_major_version }}"
current_minor_version="${{ needs.collect-version-info.outputs.current_minor_version }}"
# Print version information
echo "Current version: $current_version"
echo "Current major version: $current_major_version"
echo "Current minor version: $current_minor_version"