-
Notifications
You must be signed in to change notification settings - Fork 2k
64 lines (56 loc) · 2.08 KB
/
reflow-version.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
52
53
54
55
56
57
58
59
60
61
62
63
64
name: identify version
on:
workflow_call:
inputs:
release_type:
description: "Tagged release testing scenario"
required: false
type: string
default: ""
outputs:
chia-dev-version:
value: ${{ jobs.version.outputs.chia-dev-version }}
chia-installer-version:
value: ${{ jobs.version.outputs.chia-installer-version }}
tag-type:
value: ${{ jobs.version.outputs.tag-type }}
jobs:
version:
name: identify version
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
chia-dev-version: ${{ steps.version-number.outputs.chia-dev-version }}
chia-installer-version: ${{ steps.version-number.outputs.chia-installer-version }}
tag-type: ${{ steps.tag-type.outputs.tag-type }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: Chia-Network/actions/git-ssh-to-https@main
- name: Check tag type
id: tag-type
shell: bash
run: |
REG_B="^[0-9]+\.[0-9]+\.[0-9]+-b[0-9]+$"
REG_RC="^[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+$"
if [[ "${{ github.event.release.tag_name }}" =~ $REG_B ]] || [[ "${{ inputs.release_type }}" =~ $REG_B ]]; then
TAG_TYPE=beta
elif [[ "${{ github.event.release.tag_name }}" =~ $REG_RC ]] || [[ "${{ inputs.release_type }}" =~ $REG_RC ]]; then
TAG_TYPE=rc
fi
echo "tag-type=${TAG_TYPE}" | tee -a "$$GITHUB_OUTPUT"
- name: Create installer version number
id: version-number
# TODO figure out better way to handle versioning
run: |
python3 -m venv ../venv
. ../venv/bin/activate
python -m pip install --upgrade pip
pip install poetry "poetry-dynamic-versioning[plugin]"
VERSION=$(poetry version -s)
echo "chia-installer-version=${VERSION}" >> "$GITHUB_OUTPUT"
GIT_SHORT_HASH=$(echo "${GITHUB_SHA}" | cut -c1-8)
echo "chia-dev-version=${VERSION}-${GIT_SHORT_HASH}" >> "$GITHUB_OUTPUT"
deactivate